File tree Expand file tree Collapse file tree 1 file changed +19
-21
lines changed Expand file tree Collapse file tree 1 file changed +19
-21
lines changed Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
2
import { Router } from './Router' ;
3
3
import { StyledProvider } from '@team-aliens/design-system' ;
4
- import { useEffect } from 'react' ;
5
4
import { setCookie } from './utils/cookies' ;
6
5
7
- function App ( ) {
8
- useEffect ( ( ) => {
9
- window . setAuthToken = ( accessToken , refreshToken ) => {
10
- const expires = new Date ( ) ;
11
- expires . setDate ( expires . getDate ( ) + 7 ) ;
6
+ window . setAuthToken = ( accessToken , refreshToken ) => {
7
+ const expires = new Date ( ) ;
8
+ expires . setDate ( expires . getDate ( ) + 7 ) ;
9
+
10
+ if ( accessToken ) {
11
+ setCookie ( 'access_token' , accessToken , {
12
+ path : '/' ,
13
+ expires,
14
+ } ) ;
15
+ }
16
+ if ( refreshToken ) {
17
+ setCookie ( 'refresh_token' , refreshToken , {
18
+ path : '/' ,
19
+ expires,
20
+ } ) ;
21
+ }
22
+ window . location . reload ( ) ;
23
+ } ;
12
24
13
- if ( accessToken ) {
14
- setCookie ( 'access_token' , accessToken , {
15
- path : '/' ,
16
- expires,
17
- } ) ;
18
- }
19
- if ( refreshToken ) {
20
- setCookie ( 'refresh_token' , refreshToken , {
21
- path : '/' ,
22
- expires,
23
- } ) ;
24
- }
25
- window . location . reload ( ) ;
26
- } ;
27
- } , [ ] ) ;
25
+ function App ( ) {
28
26
return (
29
27
< StyledProvider >
30
28
< Router />
You can’t perform that action at this time.
0 commit comments