mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-10-24 23:49:06 +08:00
feat(api): add custom redirect back
This commit is contained in:
committed by
mrugesh
parent
3823ed19bc
commit
aa62fdbfe9
@@ -162,7 +162,7 @@ export function ShowSettings(props) {
|
||||
}
|
||||
|
||||
if (!showLoading && !isSignedIn) {
|
||||
return navigate(`${apiLocation}/signin`);
|
||||
return navigate(`${apiLocation}/signin?returnTo=settings`);
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -11,7 +11,9 @@ describe('<ShowSettings />', () => {
|
||||
const shallow = new ShallowRenderer();
|
||||
shallow.render(<ShowSettings {...loggedOutProps} />);
|
||||
expect(navigate).toHaveBeenCalledTimes(1);
|
||||
expect(navigate).toHaveBeenCalledWith(`${apiLocation}/signin`);
|
||||
expect(navigate).toHaveBeenCalledWith(
|
||||
`${apiLocation}/signin?returnTo=settings`
|
||||
);
|
||||
expect(true).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -91,7 +91,7 @@ export class DonatePage extends Component {
|
||||
}
|
||||
|
||||
if (!showLoading && !isSignedIn) {
|
||||
return navigate(`${apiLocation}/signin`);
|
||||
return navigate(`${apiLocation}/signin?returnTo=donate`);
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -11,7 +11,9 @@ describe('<ShowSettings />', () => {
|
||||
const shallow = new ShallowRenderer();
|
||||
shallow.render(<DonatePage {...loggedOutProps} />);
|
||||
expect(navigate).toHaveBeenCalledTimes(1);
|
||||
expect(navigate).toHaveBeenCalledWith(`${apiLocation}/signin`);
|
||||
expect(navigate).toHaveBeenCalledWith(
|
||||
`${apiLocation}/signin?returnTo=donate`
|
||||
);
|
||||
expect(true).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -50,7 +50,7 @@ function ProfilePage(props) {
|
||||
return <Loader fullScreen={true} />;
|
||||
}
|
||||
if (!showLoading && !isSignedIn) {
|
||||
return navigate(`${apiLocation}/signin`);
|
||||
return navigate(`${apiLocation}/signin?returnTo=portfolio`);
|
||||
}
|
||||
const RedirecUser = createRedirect('/' + username);
|
||||
return <RedirecUser />;
|
||||
|
||||
Reference in New Issue
Block a user