mirror of
https://github.com/ClaytonWWilson/CS307-Team24.git
synced 2025-12-16 10:18:48 +00:00
Fix loading on image upload, so it waits for new image
This commit is contained in:
parent
c96c77cd9f
commit
ab07d45205
@ -9,7 +9,8 @@ export const getUserData = () => (dispatch) => {
|
|||||||
dispatch({
|
dispatch({
|
||||||
type: SET_USER,
|
type: SET_USER,
|
||||||
payload: res.data,
|
payload: res.data,
|
||||||
})
|
});
|
||||||
|
dispatch({type: CLEAR_ERRORS});
|
||||||
})
|
})
|
||||||
.catch((err) => console.error(err));
|
.catch((err) => console.error(err));
|
||||||
}
|
}
|
||||||
@ -99,7 +100,7 @@ export const uploadImage = (formData) => (dispatch) => {
|
|||||||
axios.post('/user/image', formData)
|
axios.post('/user/image', formData)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
dispatch(getUserData());
|
dispatch(getUserData());
|
||||||
dispatch({ type: CLEAR_ERRORS });
|
// dispatch({ type: CLEAR_ERRORS });
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
|
|||||||
@ -23,7 +23,7 @@ export default function(state = initialState, action) {
|
|||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
loading: true
|
loading: true
|
||||||
}
|
};
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user