Skip to content

Commit

Permalink
Redirect after login
Browse files Browse the repository at this point in the history
  • Loading branch information
canac committed Nov 4, 2024
1 parent 3868ddc commit 6626050
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pages/login.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import Welcome from 'src/components/Welcome';
import useGetAppSettings from 'src/hooks/useGetAppSettings';
import { extractCookie } from 'src/lib/extractCookie';
import i18n from 'src/lib/i18n';
import { getQueryParam } from 'src/utils/queryParam';

const SignUpBox = styled('div')(({ theme }) => ({
marginBlock: theme.spacing(2),
Expand Down Expand Up @@ -124,10 +125,11 @@ export const getServerSideProps: GetServerSideProps = async (context) => {
`mpdx-handoff.redirect-url=; HttpOnly; path=/; Max-Age=0`,
);
}
if (context.res && session && !impersonateCookie) {
if (session && !impersonateCookie) {
const queryRedirectUrl = getQueryParam(context.query, 'redirect');
return {
redirect: {
destination: redirectCookie ?? '/accountLists',
destination: redirectCookie ?? queryRedirectUrl ?? '/accountLists',
permanent: false,
},
};
Expand Down

0 comments on commit 6626050

Please sign in to comment.