diff --git a/interface/src/contexts/authentication/Authentication.tsx b/interface/src/contexts/authentication/Authentication.tsx index bf9e05bae..bc972aaa1 100644 --- a/interface/src/contexts/authentication/Authentication.tsx +++ b/interface/src/contexts/authentication/Authentication.tsx @@ -1,6 +1,6 @@ import { useRequest } from 'alova'; import { useCallback, useEffect, useState } from 'react'; -import { useNavigate } from 'react-router-dom'; +import { redirect } from 'react-router-dom'; import { toast } from 'react-toastify'; import { AuthenticationContext } from './context'; import type { FC } from 'react'; @@ -15,8 +15,6 @@ import { useI18nContext } from 'i18n/i18n-react'; const Authentication: FC = ({ children }) => { const { LL } = useI18nContext(); - const navigate = useNavigate(); - const [initialized, setInitialized] = useState(false); const [me, setMe] = useState(); @@ -36,11 +34,12 @@ const Authentication: FC = ({ children }) => { } }; - const signOut = (redirect: boolean) => { + const signOut = (doRedirect: boolean) => { AuthenticationApi.clearAccessToken(); setMe(undefined); - if (redirect) { - navigate('/'); + if (doRedirect) { + // navigate('/'); + redirect('/'); } };