diff options
| author | adamhrv <adam@ahprojects.com> | 2019-03-28 20:01:11 +0100 |
|---|---|---|
| committer | adamhrv <adam@ahprojects.com> | 2019-03-28 20:01:11 +0100 |
| commit | 21fd4284ac0f14ec860ccda1032ef380ccfa7b2f (patch) | |
| tree | 6751b86621a1ad76ebab1ffe9f0d1a6ab053bacc /scraper/client/actions.js | |
| parent | b2c61d7ebc142b41f8cb15b00764319801d1bf5d (diff) | |
| parent | 5309b381e64f59b8f57014ad41e55d7f87ca0628 (diff) | |
Merge branch 'master' of github.com:adamhrv/megapixels_dev
Diffstat (limited to 'scraper/client/actions.js')
| -rw-r--r-- | scraper/client/actions.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/scraper/client/actions.js b/scraper/client/actions.js index 734a8cbd..b5c477f6 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, {}) ) @@ -44,5 +49,5 @@ export const postVerification = data => dispatch => ( api(dispatch, post, 'verify', '/api/verify/add', data) ) - +export const setSortedCitations = sortedCitations => dispatch => dispatch({ type: types.system.set_sorted_citations, sortedCitations }) |
