Delete Account works on the UI now

This commit is contained in:
Aaron Sun 2019-10-23 18:08:42 -04:00
parent ad853923c8
commit 45f88861c8

View File

@ -62,6 +62,20 @@ export const logoutUser = () => (dispatch) => {
}
export const deleteUser = () => (dispatch) => {
axios
.delete("/delete")
.then((res) => {
console.log(res);
console.log("User account successfully deleted.");
}
)
.catch((err) => {
dispatch ({
type: SET_ERRORS,
payload: err.response.data,
})
});
localStorage.removeItem('FBIdToken');
delete axios.defaults.headers.common['Authorization'];
dispatch({ type: SET_UNAUTHENTICATED });