From ad6284a2040837e7373b4d89644a01306f181dd5 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 28 Mar 2019 14:45:07 +0100 Subject: fetch papers by single dataset --- scraper/client/actions.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'scraper/client/actions.js') diff --git a/scraper/client/actions.js b/scraper/client/actions.js index 734a8cbd..1b5152ea 100644 --- a/scraper/client/actions.js +++ b/scraper/client/actions.js @@ -1,9 +1,10 @@ import { get, post } from './util' import * as types from './types' -export const api = (dispatch, method, tag, url, params) => { +export const api = (dispatch, method, tag, url, params, after) => { dispatch({ type: types.api.loading, tag }) return method(url, params).then(data => { + if (after) data = after(data) dispatch({ type: types.api.loaded, tag, data }) return data }).catch(err => { @@ -36,6 +37,10 @@ export const getVerifications = () => dispatch => ( api(dispatch, get, 'verifications', '/api/verifications', {}) ) +export const getVerificationsDataset = dataset => dispatch => ( + api(dispatch, get, 'verifications', '/api/verifications/' + dataset, {}) +) + export const getVerification = sha256 => dispatch => ( api(dispatch, get, 'verify', '/api/verify/' + sha256, {}) ) -- cgit v1.2.3-70-g09d2