fix: multiple redirects after account deletion (#46350)

pull/46410/head
Prathamesh Gawas 2022-06-08 20:18:17 +05:30 committed by GitHub
parent 0aabd837b7
commit f803d60be1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -1,5 +1,5 @@
import { Grid } from '@freecodecamp/react-bootstrap';
import React from 'react';
import React, { useRef } from 'react';
import Helmet from 'react-helmet';
import { useTranslation } from 'react-i18next';
import { connect } from 'react-redux';
@ -143,12 +143,13 @@ export function ShowSettings(props: ShowSettingsProps): JSX.Element {
verifyCert,
userToken
} = props;
const isSignedInRef = useRef(isSignedIn);
if (showLoading) {
return <Loader fullScreen={true} />;
}
if (!isSignedIn) {
if (!isSignedInRef.current) {
navigate(`${apiLocation}/signin`);
return <Loader fullScreen={true} />;
}

View File

@ -19,7 +19,7 @@ function* deleteAccountSaga() {
);
// remove current user information from application state
yield put(resetUserData());
yield call(navigate, '/');
yield call(navigate, '/learn');
} catch (e) {
yield put(deleteAccountError(e));
}