mirror of
https://github.com/bluewave-labs/Checkmate.git
synced 2026-01-21 00:59:44 -06:00
Removed unnecessary timeout and replaced Promise.then()
This commit is contained in:
@@ -183,13 +183,12 @@ const ProfilePanel = () => {
|
||||
};
|
||||
|
||||
// Initiates the account deletion process
|
||||
const handleDeleteAccount = () => {
|
||||
dispatch(deleteUser(authToken)).then((action) => {
|
||||
if (action.payload.success) {
|
||||
dispatch(clearAuthState());
|
||||
dispatch(clearMonitorState());
|
||||
}
|
||||
});
|
||||
const handleDeleteAccount = async () => {
|
||||
const action = await dispatch(deleteUser(authToken));
|
||||
if (action.payload.success) {
|
||||
dispatch(clearAuthState());
|
||||
dispatch(clearMonitorState());
|
||||
}
|
||||
};
|
||||
|
||||
// Modal state and control functions
|
||||
|
||||
@@ -80,9 +80,6 @@ export const deleteUser = createAsyncThunk(
|
||||
async (data, thunkApi) => {
|
||||
const user = jwtDecode(data);
|
||||
|
||||
//1.5s delay to show loading spinner
|
||||
await new Promise((resolve) => setTimeout(resolve, 1500));
|
||||
|
||||
try {
|
||||
const res = await axiosInstance.delete(`/auth/user/${user._id}`, {
|
||||
headers: { Authorization: `Bearer ${data}` },
|
||||
|
||||
Reference in New Issue
Block a user