Fix loading on image upload, so it waits for new image

This commit is contained in:
Clayton Wilson 2019-11-01 10:12:54 -04:00
parent c96c77cd9f
commit ab07d45205
2 changed files with 4 additions and 3 deletions

View File

@ -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);

View File

@ -23,7 +23,7 @@ export default function(state = initialState, action) {
return {
...state,
loading: true
}
};
default:
return state;
}