File "resolvers.js"

Full Path: /home/siazco/grocery.siazco.se/wp-content/plugins/better-wp-security/core/packages/data/src/logs/resolvers.js
File size: 417 bytes
MIME-type: text/x-java
Charset: utf-8

/**
 * Internal dependencies
 */
import { dispatch, apiFetch } from '../controls';
import { STORE_NAME, path } from './constant';
import { receiveLog } from './actions';

export function* getLogs() {
	yield dispatch( STORE_NAME, 'query', 'main', {
		per_page: 100,
	} );
}

export function* getLogById( id ) {
	const log = yield apiFetch( {
		path: `${ path }/${ id }`,
	} );
	yield receiveLog( id );

	return log;
}