Skip to content

Commit 51db180

Browse files
committed
Merge branch 'develop'
2 parents e953fc3 + d4e57f9 commit 51db180

File tree

1 file changed

+19
-21
lines changed

1 file changed

+19
-21
lines changed

src/App.tsx

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,28 @@
11
import React from 'react';
22
import { Router } from './Router';
33
import { StyledProvider } from '@team-aliens/design-system';
4-
import { useEffect } from 'react';
54
import { setCookie } from './utils/cookies';
65

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+
};
1224

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() {
2826
return (
2927
<StyledProvider>
3028
<Router />

0 commit comments

Comments
 (0)