Skip to content

Commit def11bb

Browse files
committed
Refactor(client): sendTokenToExtension 함수를 컴포넌트 외부로 이동
1 parent 3e0bbff commit def11bb

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

apps/client/src/pages/onBoarding/GoogleCallback.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@ import LoadingChippi from '@shared/components/loadingChippi/LoadingChippi';
33
import { useEffect } from 'react';
44
import { useNavigate, useSearchParams } from 'react-router-dom';
55

6+
const sendTokenToExtension = (token: string) => {
7+
window.postMessage(
8+
{
9+
type: 'SET_TOKEN',
10+
token,
11+
},
12+
window.location.origin
13+
);
14+
};
15+
616
const GoogleCallback = () => {
717
const navigate = useNavigate();
818
const [searchParams] = useSearchParams();
@@ -28,16 +38,6 @@ const GoogleCallback = () => {
2838
if (isUser) {
2939
if (accessToken) {
3040
localStorage.setItem('token', accessToken);
31-
32-
const sendTokenToExtension = (token: string) => {
33-
window.postMessage(
34-
{
35-
type: 'SET_TOKEN',
36-
token,
37-
},
38-
window.location.origin
39-
);
40-
};
4141
sendTokenToExtension(accessToken);
4242
}
4343

0 commit comments

Comments
 (0)