From 84f5d501b15e2fcfe890233bfb3f05ab0026df7f Mon Sep 17 00:00:00 2001 From: thgee Date: Thu, 22 Aug 2024 14:47:41 +0900 Subject: [PATCH 1/8] =?UTF-8?q?chore:=20=EB=AF=B8=EC=82=AC=EC=9A=A9=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/hooks/useAuth.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/core/src/hooks/useAuth.ts b/packages/core/src/hooks/useAuth.ts index ee3bfaa7..2b5c0f61 100644 --- a/packages/core/src/hooks/useAuth.ts +++ b/packages/core/src/hooks/useAuth.ts @@ -2,7 +2,6 @@ import { initializeApp } from "firebase/app"; import { getAuth, GoogleAuthProvider, - reload, signInWithPopup, signOut, } from "firebase/auth"; From f7ae03d4af2bb6ac05a170ed56583b4ad81636b8 Mon Sep 17 00:00:00 2001 From: thgee Date: Thu, 22 Aug 2024 14:56:00 +0900 Subject: [PATCH 2/8] =?UTF-8?q?feat:=20=20apiGetLoginValid=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/service/src/apis/login/apiGetLoginValid.ts | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 packages/service/src/apis/login/apiGetLoginValid.ts diff --git a/packages/service/src/apis/login/apiGetLoginValid.ts b/packages/service/src/apis/login/apiGetLoginValid.ts new file mode 100644 index 00000000..93f65eb9 --- /dev/null +++ b/packages/service/src/apis/login/apiGetLoginValid.ts @@ -0,0 +1,8 @@ +import { customFetch, getAccessToken } from "@watermelon-clap/core/src/utils"; + +export const apiGetLoginValid = () => + customFetch(`${import.meta.env.VITE_BACK_BASE_URL}/event/lotteries/login`, { + headers: { + Authorization: `Bearer ${getAccessToken()}`, + }, + }); From e9c3f60abab0ecfd6c73c4a30e2f672a39183402 Mon Sep 17 00:00:00 2001 From: thgee Date: Thu, 22 Aug 2024 15:15:45 +0900 Subject: [PATCH 3/8] =?UTF-8?q?feat:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?=EC=8B=9C=20`apiGetLoginValid`=20=ED=98=B8=EC=B6=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/apis/login/apiGetLoginValid.ts | 7 +++++++ packages/core/src/hooks/useAuth.ts | 2 ++ packages/service/src/apis/login/apiGetLoginValid.ts | 8 -------- packages/service/src/apis/partsEvent/apiPostParts.ts | 1 - packages/service/tsconfig.json | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) create mode 100644 packages/core/src/apis/login/apiGetLoginValid.ts delete mode 100644 packages/service/src/apis/login/apiGetLoginValid.ts diff --git a/packages/core/src/apis/login/apiGetLoginValid.ts b/packages/core/src/apis/login/apiGetLoginValid.ts new file mode 100644 index 00000000..ed9a4020 --- /dev/null +++ b/packages/core/src/apis/login/apiGetLoginValid.ts @@ -0,0 +1,7 @@ +export const apiGetLoginValid = () => + fetch(`${import.meta.env.VITE_BACK_BASE_URL}/event/lotteries/login`, { + headers: { + Authorization: `Bearer ${localStorage.getItem("accessToken")}`, + }, + credentials: "include", + }); diff --git a/packages/core/src/hooks/useAuth.ts b/packages/core/src/hooks/useAuth.ts index 2b5c0f61..30702d48 100644 --- a/packages/core/src/hooks/useAuth.ts +++ b/packages/core/src/hooks/useAuth.ts @@ -1,3 +1,4 @@ +import { apiGetLoginValid } from "@core/apis/login/apiGetLoginValid"; import { initializeApp } from "firebase/app"; import { getAuth, @@ -29,6 +30,7 @@ export const useAuth = () => { const expirationMs = new Date(expirationTime).getTime(); localStorage.setItem("accessToken", token); localStorage.setItem("expirationTime", String(expirationMs)); + apiGetLoginValid(); resolve({ token }); }) .catch((error) => reject(error)); diff --git a/packages/service/src/apis/login/apiGetLoginValid.ts b/packages/service/src/apis/login/apiGetLoginValid.ts deleted file mode 100644 index 93f65eb9..00000000 --- a/packages/service/src/apis/login/apiGetLoginValid.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { customFetch, getAccessToken } from "@watermelon-clap/core/src/utils"; - -export const apiGetLoginValid = () => - customFetch(`${import.meta.env.VITE_BACK_BASE_URL}/event/lotteries/login`, { - headers: { - Authorization: `Bearer ${getAccessToken()}`, - }, - }); diff --git a/packages/service/src/apis/partsEvent/apiPostParts.ts b/packages/service/src/apis/partsEvent/apiPostParts.ts index c21c2f54..90458a12 100644 --- a/packages/service/src/apis/partsEvent/apiPostParts.ts +++ b/packages/service/src/apis/partsEvent/apiPostParts.ts @@ -8,7 +8,6 @@ export const apiPostParts = (): Promise => `, { method: "POST", - credentials: "include", headers: { Authorization: `Bearer ${getAccessToken()}`, }, diff --git a/packages/service/tsconfig.json b/packages/service/tsconfig.json index 9dc588b2..14831788 100644 --- a/packages/service/tsconfig.json +++ b/packages/service/tsconfig.json @@ -32,5 +32,5 @@ "noFallthroughCasesInSwitch": true, }, "files": [], - "include": ["src"] + "include": ["src", "../core/src/login"] } \ No newline at end of file From 81c3bb6c08d3302c3e431d5239c5e38534764aa5 Mon Sep 17 00:00:00 2001 From: thgee Date: Thu, 22 Aug 2024 15:22:53 +0900 Subject: [PATCH 4/8] =?UTF-8?q?chore:=20login=20=EB=B9=84=EB=8F=99?= =?UTF-8?q?=EA=B8=B0=20=EB=A1=9C=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/hooks/useAuth.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/core/src/hooks/useAuth.ts b/packages/core/src/hooks/useAuth.ts index 30702d48..0d994d21 100644 --- a/packages/core/src/hooks/useAuth.ts +++ b/packages/core/src/hooks/useAuth.ts @@ -30,8 +30,7 @@ export const useAuth = () => { const expirationMs = new Date(expirationTime).getTime(); localStorage.setItem("accessToken", token); localStorage.setItem("expirationTime", String(expirationMs)); - apiGetLoginValid(); - resolve({ token }); + apiGetLoginValid().then(() => resolve({ token })); }) .catch((error) => reject(error)); }); From 64a205f1e8d4681f3da415834d9ac5664b490375 Mon Sep 17 00:00:00 2001 From: thgee Date: Thu, 22 Aug 2024 15:33:00 +0900 Subject: [PATCH 5/8] =?UTF-8?q?chore:=20apiGetLoginValid=20=ED=95=A8?= =?UTF-8?q?=EC=88=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/apis/login/apiGetLoginValid.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/core/src/apis/login/apiGetLoginValid.ts b/packages/core/src/apis/login/apiGetLoginValid.ts index ed9a4020..10b98a31 100644 --- a/packages/core/src/apis/login/apiGetLoginValid.ts +++ b/packages/core/src/apis/login/apiGetLoginValid.ts @@ -1,7 +1,9 @@ +import { customFetch, getAccessToken } from "@core/utils"; + export const apiGetLoginValid = () => - fetch(`${import.meta.env.VITE_BACK_BASE_URL}/event/lotteries/login`, { + customFetch(`${import.meta.env.VITE_BACK_BASE_URL}/event/lotteries/login`, { headers: { - Authorization: `Bearer ${localStorage.getItem("accessToken")}`, + Authorization: `Bearer ${getAccessToken()}`, }, credentials: "include", }); From 7d20de6d9c35ef8f604fbe169bc766d4b3b18486 Mon Sep 17 00:00:00 2001 From: thgee Date: Thu, 22 Aug 2024 15:38:44 +0900 Subject: [PATCH 6/8] =?UTF-8?q?fix:=20apiGetLoginValid=20import=20path=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/hooks/useAuth.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/hooks/useAuth.ts b/packages/core/src/hooks/useAuth.ts index 0d994d21..780406f8 100644 --- a/packages/core/src/hooks/useAuth.ts +++ b/packages/core/src/hooks/useAuth.ts @@ -1,4 +1,4 @@ -import { apiGetLoginValid } from "@core/apis/login/apiGetLoginValid"; +import { apiGetLoginValid } from "../apis/login/apiGetLoginValid"; import { initializeApp } from "firebase/app"; import { getAuth, From 9fb7d11d3bf0b57a260206d65f0fb95a784858f8 Mon Sep 17 00:00:00 2001 From: thgee Date: Thu, 22 Aug 2024 15:41:18 +0900 Subject: [PATCH 7/8] =?UTF-8?q?fix:=20customFetch,=20getAccessToken=20impo?= =?UTF-8?q?rt=20path=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/apis/login/apiGetLoginValid.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/apis/login/apiGetLoginValid.ts b/packages/core/src/apis/login/apiGetLoginValid.ts index 10b98a31..1fa29a19 100644 --- a/packages/core/src/apis/login/apiGetLoginValid.ts +++ b/packages/core/src/apis/login/apiGetLoginValid.ts @@ -1,4 +1,4 @@ -import { customFetch, getAccessToken } from "@core/utils"; +import { customFetch, getAccessToken } from "../../utils"; export const apiGetLoginValid = () => customFetch(`${import.meta.env.VITE_BACK_BASE_URL}/event/lotteries/login`, { From b59905672f1d0e33e6f6e22e5856a8fe70de9afa Mon Sep 17 00:00:00 2001 From: thgee Date: Thu, 22 Aug 2024 15:48:01 +0900 Subject: [PATCH 8/8] =?UTF-8?q?feat:=20=20tsconfig=EC=97=90=20=EB=B6=88?= =?UTF-8?q?=ED=95=84=EC=9A=94=20=EC=BD=94=EB=93=9C=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/service/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/service/tsconfig.json b/packages/service/tsconfig.json index 14831788..9dc588b2 100644 --- a/packages/service/tsconfig.json +++ b/packages/service/tsconfig.json @@ -32,5 +32,5 @@ "noFallthroughCasesInSwitch": true, }, "files": [], - "include": ["src", "../core/src/login"] + "include": ["src"] } \ No newline at end of file