From 2ebe47a0ec566be75522da533e76a2f491227a51 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 12 Oct 2020 19:11:07 +0200 Subject: new annotations --- animism-align/frontend/app/utils/index.js | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'animism-align/frontend/app/utils/index.js') 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) => { -- cgit v1.2.3-70-g09d2