Skip to content

Commit

Permalink
redirects correctly after signing
Browse files Browse the repository at this point in the history
  • Loading branch information
andresgnlez committed Apr 17, 2024
1 parent cc1af22 commit 7453d3a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions client/src/pages/auth/signin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import toast from 'react-hot-toast';
import AuthenticationLayout from 'layouts/authentication';
import { Label, Input, Checkbox } from 'components/forms';
import { Button } from 'components/button';
import { env } from '@/env.mjs';

import type { ReactElement } from 'react';
import type { NextPageWithLayout } from 'pages/_app';
Expand Down Expand Up @@ -44,9 +45,14 @@ const SignIn: NextPageWithLayout = () => {
});

if (ok) {
router.push((router.query?.callbackUrl as string) || '/analysis/map', undefined, {
shallow: true,
});
router.push(
(router.query?.callbackUrl as string) ||
(env.NEXT_PUBLIC_ENABLE_EUDR ? '/eudr' : '/analysis/map'),
undefined,
{
shallow: true,
},
);
} else {
setIsLoading(false);
toast.error('Login failed. Your email or password is incorrect.');
Expand Down

0 comments on commit 7453d3a

Please sign in to comment.