From f1ed21f3f09cfb1ea560836ccd0880a025bb0a7a Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Wed, 28 Jul 2021 16:57:54 +0200 Subject: [PATCH] move the commit into the try/catch block --- src/store/modules/coaches/actions.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/store/modules/coaches/actions.js b/src/store/modules/coaches/actions.js index 14ef6b8..265042f 100644 --- a/src/store/modules/coaches/actions.js +++ b/src/store/modules/coaches/actions.js @@ -14,13 +14,15 @@ export default { try { await getAPI.put(`coaches/${userId}.json`, coachData); + context.commit('registerCoach', { + ...coachData, + id: userId + }); + } catch (err) { + console.log(err.response.status); + } } catch (err) { console.log(err.response.status); } - - context.commit('registerCoach', { - ...coachData, - id: userId - }); } };