feat(api): add custom redirect back

This commit is contained in:
Mrugesh Mohapatra
2019-10-21 18:03:26 +05:30
committed by mrugesh
parent 3823ed19bc
commit aa62fdbfe9
9 changed files with 32 additions and 8 deletions
@@ -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();
});
});
+1 -1
View File
@@ -91,7 +91,7 @@ export class DonatePage extends Component {
}
if (!showLoading && !isSignedIn) {
return navigate(`${apiLocation}/signin`);
return navigate(`${apiLocation}/signin?returnTo=donate`);
}
return (
+3 -1
View File
@@ -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();
});
});
+1 -1
View File
@@ -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 />;