Commit 15b9751 1 parent 4048f58 commit 15b9751 Copy full SHA for 15b9751
File tree 1 file changed +5
-6
lines changed
interface/src/contexts/authentication
1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change 1
1
import { useRequest } from 'alova' ;
2
2
import { useCallback , useEffect , useState } from 'react' ;
3
- import { useNavigate } from 'react-router-dom' ;
3
+ import { redirect } from 'react-router-dom' ;
4
4
import { toast } from 'react-toastify' ;
5
5
import { AuthenticationContext } from './context' ;
6
6
import type { FC } from 'react' ;
@@ -15,8 +15,6 @@ import { useI18nContext } from 'i18n/i18n-react';
15
15
const Authentication : FC < RequiredChildrenProps > = ( { children } ) => {
16
16
const { LL } = useI18nContext ( ) ;
17
17
18
- const navigate = useNavigate ( ) ;
19
-
20
18
const [ initialized , setInitialized ] = useState < boolean > ( false ) ;
21
19
const [ me , setMe ] = useState < Me > ( ) ;
22
20
@@ -36,11 +34,12 @@ const Authentication: FC<RequiredChildrenProps> = ({ children }) => {
36
34
}
37
35
} ;
38
36
39
- const signOut = ( redirect : boolean ) => {
37
+ const signOut = ( doRedirect : boolean ) => {
40
38
AuthenticationApi . clearAccessToken ( ) ;
41
39
setMe ( undefined ) ;
42
- if ( redirect ) {
43
- navigate ( '/' ) ;
40
+ if ( doRedirect ) {
41
+ // navigate('/');
42
+ redirect ( '/' ) ;
44
43
}
45
44
} ;
46
45
You can’t perform that action at this time.
0 commit comments