diff options
Diffstat (limited to 'animism-align/frontend/app/utils/index.js')
| -rw-r--r-- | animism-align/frontend/app/utils/index.js | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/animism-align/frontend/app/utils/index.js b/animism-align/frontend/app/utils/index.js index 03c484c..ac4b83b 100644 --- a/animism-align/frontend/app/utils/index.js +++ b/animism-align/frontend/app/utils/index.js @@ -231,16 +231,22 @@ export const post = (dispatch, type=api_type, tag, url, data) => { headers, }) .then(res => res.json()) - .then(res => dispatch({ - type: type.loaded, - tag, - data: res, - })) - .catch(err => dispatch({ - type: type.error, - tag, - err, - })) + .then(res => { + dispatch({ + type: type.loaded, + tag, + data: res, + }) + return res + }) + .catch(err => { + dispatch({ + type: type.error, + tag, + err, + }) + return err + }) } export const api = (dispatch, type=api_type, tag, url, data) => { |
