diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2019-02-13 13:58:11 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2019-02-13 13:58:11 +0100 |
| commit | 392ea8d0ba2fdc713ae156517b0575e8219b9f1c (patch) | |
| tree | bb29c19f9f0a2d970c39c813130361405fccbe4e /scraper/client/actions.js | |
| parent | dc7d9cbba842472efb33186e97ee55751e4d50ca (diff) | |
adding geocode client
Diffstat (limited to 'scraper/client/actions.js')
| -rw-r--r-- | scraper/client/actions.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/scraper/client/actions.js b/scraper/client/actions.js new file mode 100644 index 00000000..f281a34c --- /dev/null +++ b/scraper/client/actions.js @@ -0,0 +1,23 @@ +import { get, post } from './util' +import * as types from './types' + +export const api = (dispatch, method, tag, url, params) => { + dispatch({ type: types.api.loading, tag }) + get(url, params).then(data => { + dispatch({ type: types.api.loaded, tag, data }) + }).catch(err => { + dispatch({ type: types.api.error, tag, err }) + }) +} + +export const getInstitutions = () => dispatch => { + api(dispatch, get, 'institutions', '/api/institutions', {}) +} + +export const getPapers = () => dispatch => { + api(dispatch, get, 'papers', '/api/papers', {}) +} + +export const postAddress = data => dispatch => { + api(dispatch, post, 'address', '/api/address', data) +} |
