fix: Do not try to parse an empty response
This commit is contained in:
@@ -2,7 +2,6 @@ import { navigate } from 'gatsby';
|
||||
import { call, put, takeEvery } from 'redux-saga/effects';
|
||||
|
||||
import {
|
||||
deleteAccountComplete,
|
||||
deleteAccountError,
|
||||
resetProgressComplete,
|
||||
resetProgressError
|
||||
@@ -13,12 +12,16 @@ import { createFlashMessage } from '../../components/Flash/redux';
|
||||
|
||||
function* deleteAccountSaga() {
|
||||
try {
|
||||
const { data: response } = yield call(postDeleteAccount);
|
||||
yield put(deleteAccountComplete(response));
|
||||
yield call(postDeleteAccount);
|
||||
yield put(
|
||||
createFlashMessage({
|
||||
type: 'info',
|
||||
message: 'Your account has been successfully deleted'
|
||||
})
|
||||
);
|
||||
// remove current user information from application state
|
||||
yield put(resetUserData());
|
||||
yield call(navigate, '/');
|
||||
yield put(createFlashMessage(response));
|
||||
} catch (e) {
|
||||
yield put(deleteAccountError(e));
|
||||
}
|
||||
|
@@ -97,7 +97,6 @@ export const resetProgressComplete = createAction(types.resetProgressComplete);
|
||||
export const resetProgressError = createAction(types.resetProgressError);
|
||||
|
||||
export const deleteAccount = createAction(types.deleteAccount);
|
||||
export const deleteAccountComplete = createAction(types.deleteAccountComplete);
|
||||
export const deleteAccountError = createAction(types.deleteAccountError);
|
||||
|
||||
export const usernameValidationSelector = state => state[ns].usernameValidation;
|
||||
|
Reference in New Issue
Block a user