From ab07d45205b62c368e8809f26739e6b084933ba6 Mon Sep 17 00:00:00 2001 From: Clayton Wilson Date: Fri, 1 Nov 2019 10:12:54 -0400 Subject: [PATCH] Fix loading on image upload, so it waits for new image --- twistter-frontend/src/redux/actions/userActions.js | 5 +++-- twistter-frontend/src/redux/reducers/uiReducer.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/twistter-frontend/src/redux/actions/userActions.js b/twistter-frontend/src/redux/actions/userActions.js index 41bd4bb..5067258 100644 --- a/twistter-frontend/src/redux/actions/userActions.js +++ b/twistter-frontend/src/redux/actions/userActions.js @@ -9,7 +9,8 @@ export const getUserData = () => (dispatch) => { dispatch({ type: SET_USER, payload: res.data, - }) + }); + dispatch({type: CLEAR_ERRORS}); }) .catch((err) => console.error(err)); } @@ -99,7 +100,7 @@ export const uploadImage = (formData) => (dispatch) => { axios.post('/user/image', formData) .then(() => { dispatch(getUserData()); - dispatch({ type: CLEAR_ERRORS }); + // dispatch({ type: CLEAR_ERRORS }); }) .catch(err => { console.log(err); diff --git a/twistter-frontend/src/redux/reducers/uiReducer.js b/twistter-frontend/src/redux/reducers/uiReducer.js index 65e781d..491206e 100644 --- a/twistter-frontend/src/redux/reducers/uiReducer.js +++ b/twistter-frontend/src/redux/reducers/uiReducer.js @@ -23,7 +23,7 @@ export default function(state = initialState, action) { return { ...state, loading: true - } + }; default: return state; }