From 45f88861c8bae1501d2a7965c33f3653316c45f8 Mon Sep 17 00:00:00 2001 From: Aaron Sun Date: Wed, 23 Oct 2019 18:08:42 -0400 Subject: [PATCH] Delete Account works on the UI now --- twistter-frontend/src/redux/actions/userActions.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/twistter-frontend/src/redux/actions/userActions.js b/twistter-frontend/src/redux/actions/userActions.js index f6cd7f9..5993804 100644 --- a/twistter-frontend/src/redux/actions/userActions.js +++ b/twistter-frontend/src/redux/actions/userActions.js @@ -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 });