Merge branch 'assessment' into backend-connection

This commit is contained in:
Delucse
2020-12-01 14:43:25 +01:00
6 changed files with 64 additions and 59 deletions
+4 -2
View File
@@ -18,13 +18,14 @@ export const getTutorial = (id) => (dispatch, getState) => {
type: GET_TUTORIAL,
payload: tutorial
});
dispatch(returnSuccess(res.data.message, res.status));
});
})
.catch(err => {
dispatch({type: TUTORIAL_PROGRESS});
if(err.response){
dispatch(returnErrors(err.response.data.message, err.response.status, 'GET_TUTORIAL_FAIL'));
}
dispatch({type: TUTORIAL_PROGRESS});
});
};
@@ -44,13 +45,14 @@ export const getTutorials = () => (dispatch, getState) => {
payload: tutorials
});
dispatch({type: TUTORIAL_PROGRESS});
dispatch(returnSuccess(res.data.message, res.status));
});
})
.catch(err => {
dispatch({type: TUTORIAL_PROGRESS});
if(err.response){
dispatch(returnErrors(err.response.data.message, err.response.status, 'GET_TUTORIALS_FAIL'));
}
dispatch({type: TUTORIAL_PROGRESS});
});
};