diff --git a/packages/apps/human-app/frontend/src/components/layout/drawer-menu-items/drawer-menu-items-operator.tsx b/packages/apps/human-app/frontend/src/components/layout/drawer-menu-items/drawer-menu-items-operator.tsx index 65fe163768..03f63c3601 100644 --- a/packages/apps/human-app/frontend/src/components/layout/drawer-menu-items/drawer-menu-items-operator.tsx +++ b/packages/apps/human-app/frontend/src/components/layout/drawer-menu-items/drawer-menu-items-operator.tsx @@ -2,6 +2,7 @@ import { t } from 'i18next'; import type { BottomMenuItem } from '@/components/layout/protected/drawer-navigation'; import { HelpIcon, UserOutlinedIcon } from '@/components/ui/icons'; import { routerPaths } from '@/router/router-paths'; +import { env } from '@/shared/env'; export const operatorDrawerBottomMenuItems: BottomMenuItem[] = [ { @@ -11,7 +12,7 @@ export const operatorDrawerBottomMenuItems: BottomMenuItem[] = [ }, { label: t('components.DrawerNavigation.help'), - link: routerPaths.homePage, + link: env.VITE_HUMAN_PROTOCOL_HELP_URL, icon: <HelpIcon />, }, ]; diff --git a/packages/apps/human-app/frontend/src/components/layout/drawer-menu-items/drawer-menu-items-worker.tsx b/packages/apps/human-app/frontend/src/components/layout/drawer-menu-items/drawer-menu-items-worker.tsx index 1be8346b42..a03771e2a0 100644 --- a/packages/apps/human-app/frontend/src/components/layout/drawer-menu-items/drawer-menu-items-worker.tsx +++ b/packages/apps/human-app/frontend/src/components/layout/drawer-menu-items/drawer-menu-items-worker.tsx @@ -7,6 +7,7 @@ import type { } from '@/components/layout/protected/drawer-navigation'; import { HelpIcon, UserOutlinedIcon, WorkIcon } from '@/components/ui/icons'; import { routerPaths } from '@/router/router-paths'; +import { env } from '@/shared/env'; export const workerDrawerTopMenuItems = ( addressRegistered: boolean @@ -47,7 +48,7 @@ export const workerDrawerBottomMenuItems: BottomMenuItem[] = [ }, { label: t('components.DrawerNavigation.help'), - link: routerPaths.homePage, + link: env.VITE_HUMAN_PROTOCOL_HELP_URL, icon: <HelpIcon />, }, ]; diff --git a/packages/apps/human-app/frontend/src/pages/homepage/components/operator-signin.tsx b/packages/apps/human-app/frontend/src/pages/homepage/components/operator-signin.tsx index eb425430fa..baf18e4131 100644 --- a/packages/apps/human-app/frontend/src/pages/homepage/components/operator-signin.tsx +++ b/packages/apps/human-app/frontend/src/pages/homepage/components/operator-signin.tsx @@ -17,9 +17,14 @@ export function OperatorSignIn() { isError: isSignInMutationError, error: signInMutationError, } = useWeb3SignIn(); - const { user } = useWeb3Auth(); + const { user, signOut } = useWeb3Auth(); const modalWasOpened = useRef(false); + useEffect(() => { + signOut(); + // eslint-disable-next-line react-hooks/exhaustive-deps -- ... + }, []); + useEffect(() => { if (isConnected && modalWasOpened.current) { signInMutation({ address, type: PrepareSignatureType.SignIn }); diff --git a/packages/apps/human-app/frontend/src/pages/homepage/components/worker-signin.tsx b/packages/apps/human-app/frontend/src/pages/homepage/components/worker-signin.tsx index f351cd4bad..1bf95ace9a 100644 --- a/packages/apps/human-app/frontend/src/pages/homepage/components/worker-signin.tsx +++ b/packages/apps/human-app/frontend/src/pages/homepage/components/worker-signin.tsx @@ -1,16 +1,9 @@ import { t } from 'i18next'; import { Link } from 'react-router-dom'; -import { useAuth } from '@/auth/use-auth'; import { Button } from '@/components/ui/button'; import { routerPaths } from '@/router/router-paths'; export function WorkerSignIn() { - const { user } = useAuth(); - - const redirectPath = user - ? routerPaths.worker.profile - : routerPaths.worker.signIn; - return ( <Button component={Link} @@ -19,7 +12,7 @@ export function WorkerSignIn() { sx={{ mb: '1.5625rem', }} - to={redirectPath} + to={routerPaths.worker.signIn} variant="contained" > {t('homepage.workerSignIn')} diff --git a/packages/apps/human-app/frontend/src/pages/worker/sign-in.page.tsx b/packages/apps/human-app/frontend/src/pages/worker/sign-in.page.tsx index 43f37f07d6..2bd5c9aa13 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/sign-in.page.tsx +++ b/packages/apps/human-app/frontend/src/pages/worker/sign-in.page.tsx @@ -3,7 +3,7 @@ import { Grid, Typography } from '@mui/material'; import { zodResolver } from '@hookform/resolvers/zod'; import { useTranslation } from 'react-i18next'; import { t as i18NextT } from 'i18next'; -import { Link, useNavigate } from 'react-router-dom'; +import { Link } from 'react-router-dom'; import { useEffect } from 'react'; import { PageCard } from '@/components/ui/page-card'; import { Input } from '@/components/data-entry/input'; @@ -29,14 +29,13 @@ function formattedSignInErrorMessage(unknownError: unknown) { export function SignInWorkerPage() { const { t } = useTranslation(); - const { user } = useAuth(); - const navigate = useNavigate(); + const { user, signOut } = useAuth(); useEffect(() => { if (user) { - navigate(routerPaths.worker.profile, { replace: true }); + signOut(); } - }, [navigate, user]); + }, [signOut, user]); const methods = useForm<SignInDto>({ defaultValues: { diff --git a/packages/apps/human-app/frontend/src/pages/worker/sign-up.page.tsx b/packages/apps/human-app/frontend/src/pages/worker/sign-up.page.tsx index 3cbc8933c6..d6c325561f 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/sign-up.page.tsx +++ b/packages/apps/human-app/frontend/src/pages/worker/sign-up.page.tsx @@ -6,7 +6,7 @@ import Typography from '@mui/material/Typography'; import Link from '@mui/material/Link'; import { t } from 'i18next'; import omit from 'lodash/omit'; -import { Navigate } from 'react-router-dom'; +import { useEffect } from 'react'; import type { SignUpDto } from '@/api/servieces/worker/sign-up'; import { signUpDtoSchema, @@ -32,7 +32,13 @@ function formattedSignUpErrorMessage(unknownError: unknown) { } export function SignUpWorkerPage() { - const { user } = useAuth(); + const { user, signOut } = useAuth(); + + useEffect(() => { + if (user) { + signOut(); + } + }, [signOut, user]); const methods = useForm<SignUpDto>({ defaultValues: { @@ -56,10 +62,6 @@ export function SignUpWorkerPage() { signUpWorkerMutate(omit(data, ['confirmPassword'])); }; - if (user) { - return <Navigate replace to={routerPaths.worker.profile} />; - } - return ( <PageCard alert={