Skip to content

Commit

Permalink
Fix: delete account warning on email revalidation not shown
Browse files Browse the repository at this point in the history
  • Loading branch information
ivard committed Apr 18, 2024
1 parent 24ed66a commit 9bbae31
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,19 @@ function handleDeleteAccount({ dispatch }) {
.then((res) => {
if (res.status === 204) {
dispatch({ type: 'logout' });
} else if (res.status === 500 && res.error === 'REVALIDATE_EMAIL') {
dispatch({
type: 'raiseWarning',
explanation: 'delete-account-mail-explanation',
details: 'delete-account-mail-details',
});
} else {
throw res.status;
return res;
}
return res.json().then((resjson) => {
if (res.status === 500 && resjson.error === 'REVALIDATE_EMAIL') {
dispatch({
type: 'raiseWarning',
explanation: 'delete-account-mail-explanation',
details: 'delete-account-mail-details',
});
} else {
throw res.status;
}
});
})
.catch((err) => {
dispatch({ type: 'raiseError', errorMessage: `Error while deleting account: ${err}` });
Expand Down

0 comments on commit 9bbae31

Please sign in to comment.