fix: Do not try to parse an empty response

This commit is contained in:
Bouncey
2019-02-26 21:17:57 +00:00
committed by Valeriy
parent 769ec3cb63
commit d3418dfecf
3 changed files with 11 additions and 16 deletions

View File

@@ -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));
}

View File

@@ -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;