From 53d6a3c4bfe281156a68868a0baabe0cf72c31ef Mon Sep 17 00:00:00 2001 From: dasosann Date: Tue, 12 May 2026 15:31:35 +0900 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=EC=98=A8=EB=B3=B4=EB=94=A9=20?= =?UTF-8?q?=ED=86=A0=ED=81=B0=20=EA=B5=90=EC=B2=B4=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/actions/admin/adminLoginAction.ts | 50 ++------------------------ lib/actions/loginAction.ts | 51 ++------------------------- 2 files changed, 4 insertions(+), 97 deletions(-) diff --git a/lib/actions/admin/adminLoginAction.ts b/lib/actions/admin/adminLoginAction.ts index 0dd0ee0..30f3ccf 100644 --- a/lib/actions/admin/adminLoginAction.ts +++ b/lib/actions/admin/adminLoginAction.ts @@ -32,54 +32,8 @@ export async function adminLoginAction( body: { email, password }, }); - // ๐Ÿช ๋ฐฑ์—”๋“œ๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ์ฟ ํ‚ค๊ฐ€ ์žˆ๋‹ค๋ฉด ๋ธŒ๋ผ์šฐ์ €์— ๋ฐฐ๋‹ฌํ•ด์ค๋‹ˆ๋‹ค. - if (setCookie) { - const { cookies } = await import("next/headers"); - const cookieStore = await cookies(); - - setCookie.forEach((cookieStr) => { - const [nameValue, ...options] = cookieStr.split(";"); - const [name, ...nameParts] = nameValue.split("="); - const value = nameParts.join("="); - - const cookieOptions: { - path?: string; - httpOnly?: boolean; - secure?: boolean; - maxAge?: number; - expires?: Date; - sameSite?: "strict" | "lax" | "none" | boolean; - domain?: string; - } = {}; - - options.forEach((opt) => { - const [key, ...valueParts] = opt.trim().split("="); - const val = valueParts.join("="); - const k = key.toLowerCase(); - if (k === "path") cookieOptions.path = val; - if (k === "httponly") cookieOptions.httpOnly = true; - if (k === "secure") cookieOptions.secure = true; - if (k === "max-age") cookieOptions.maxAge = parseInt(val); - if (k === "expires") cookieOptions.expires = new Date(val); - if (k === "domain") cookieOptions.domain = val; - if (k === "samesite") - cookieOptions.sameSite = val.toLowerCase() as - | "strict" - | "lax" - | "none"; - }); - - // ๋ฐฐํฌ ํ™˜๊ฒฝ์—์„œ๋Š” ๋ฐฑ์—”๋“œ์™€ ์ง์ ‘ ํ†ต์‹ ํ•˜๋ฏ€๋กœ, ์„œ๋ธŒ๋„๋ฉ”์ธ ๊ฐ„ ๊ณต์œ ๋ฅผ ์œ„ํ•ด ๋ช…์‹œ์ ์œผ๋กœ ๋„๋ฉ”์ธ ์„ค์ • - if (process.env.NODE_ENV === "production") { - cookieOptions.domain = ".comatching.site"; - } else { - // ๋กœ์ปฌ์—์„œ๋Š” ๋„๋ฉ”์ธ์„ ์ง€์›Œ์•ผ ๋ธŒ๋ผ์šฐ์ €๊ฐ€ localhost์—์„œ ์ฟ ํ‚ค๋ฅผ ์ •์ƒ์ ์œผ๋กœ ์ €์žฅํ•จ - delete cookieOptions.domain; - } - - cookieStore.set(name, value, cookieOptions); - }); - } + // ๐Ÿช serverApi.post ๋‚ด๋ถ€์—์„œ response header์˜ set-cookie๋ฅผ ํŒŒ์‹ฑํ•˜์—ฌ + // ์ด๋ฏธ cookieStore์— ์ €์žฅํ–ˆ์œผ๋ฏ€๋กœ, ์—ฌ๊ธฐ์„œ ๋ณ„๋„๋กœ ์ฒ˜๋ฆฌํ•  ํ•„์š”๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. } catch (error) { if ( error instanceof Error && diff --git a/lib/actions/loginAction.ts b/lib/actions/loginAction.ts index 316a378..fb5d350 100644 --- a/lib/actions/loginAction.ts +++ b/lib/actions/loginAction.ts @@ -30,55 +30,8 @@ export async function loginAction( body: { email, password }, }); - // ๐Ÿช ๋ฐฑ์—”๋“œ๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ์ฟ ํ‚ค๊ฐ€ ์žˆ๋‹ค๋ฉด ๋ธŒ๋ผ์šฐ์ €์— ๋ฐฐ๋‹ฌํ•ด์ค๋‹ˆ๋‹ค. - if (setCookie) { - const { cookies } = await import("next/headers"); - const cookieStore = await cookies(); - - setCookie.forEach((cookieStr) => { - // Axios๊ฐ€ ์ค€ ์ฟ ํ‚ค ๋ฌธ์ž์—ด์„ ํŒŒ์‹ฑํ•ฉ๋‹ˆ๋‹ค (name=value; Path=/ ...) - const [nameValue, ...options] = cookieStr.split(";"); - const [name, ...nameParts] = nameValue.split("="); - const value = nameParts.join("="); - - const cookieOptions: { - path?: string; - httpOnly?: boolean; - secure?: boolean; - maxAge?: number; - expires?: Date; - sameSite?: "strict" | "lax" | "none" | boolean; - domain?: string; - } = {}; - - options.forEach((opt) => { - const [key, ...valueParts] = opt.trim().split("="); - const val = valueParts.join("="); - const k = key.toLowerCase(); - if (k === "path") cookieOptions.path = val; - if (k === "httponly") cookieOptions.httpOnly = true; - if (k === "secure") cookieOptions.secure = true; - if (k === "max-age") cookieOptions.maxAge = parseInt(val); - if (k === "expires") cookieOptions.expires = new Date(val); - if (k === "domain") cookieOptions.domain = val; - if (k === "samesite") - cookieOptions.sameSite = val.toLowerCase() as - | "strict" - | "lax" - | "none"; - }); - - // ๋ฐฐํฌ ํ™˜๊ฒฝ์—์„œ๋Š” ๋ฐฑ์—”๋“œ์™€ ์ง์ ‘ ํ†ต์‹ ํ•˜๋ฏ€๋กœ, ์„œ๋ธŒ๋„๋ฉ”์ธ ๊ฐ„ ๊ณต์œ ๋ฅผ ์œ„ํ•ด ๋ช…์‹œ์ ์œผ๋กœ ๋„๋ฉ”์ธ ์„ค์ • - if (process.env.NODE_ENV === "production") { - cookieOptions.domain = ".comatching.site"; - } else { - // ๋กœ์ปฌ์—์„œ๋Š” ๋„๋ฉ”์ธ์„ ์ง€์›Œ์•ผ ๋ธŒ๋ผ์šฐ์ €๊ฐ€ localhost์—์„œ ์ฟ ํ‚ค๋ฅผ ์ •์ƒ์ ์œผ๋กœ ์ €์žฅํ•จ - delete cookieOptions.domain; - } - - cookieStore.set(name, value, cookieOptions); - }); - } + // ๐Ÿช serverApi.post ๋‚ด๋ถ€์—์„œ response header์˜ set-cookie๋ฅผ ํŒŒ์‹ฑํ•˜์—ฌ + // ์ด๋ฏธ cookieStore์— ์ €์žฅํ–ˆ์œผ๋ฏ€๋กœ, ์—ฌ๊ธฐ์„œ ๋ณ„๋„๋กœ ์ฒ˜๋ฆฌํ•  ํ•„์š”๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. if (finalUrl) { // https://comatching.site/onboarding -> /onboarding ์ถ”์ถœ From 3a7359167df959b106749fe1949308a2b096cfe9 Mon Sep 17 00:00:00 2001 From: dasosann Date: Tue, 12 May 2026 15:34:40 +0900 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20=ED=83=88=ED=87=B4=20api=EC=97=B0?= =?UTF-8?q?=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/mypage/_components/ScreenMyPage.tsx | 21 +++++++++--- lib/actions/authAction.ts | 45 +++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 4 deletions(-) diff --git a/app/mypage/_components/ScreenMyPage.tsx b/app/mypage/_components/ScreenMyPage.tsx index b65aff2..aa67090 100644 --- a/app/mypage/_components/ScreenMyPage.tsx +++ b/app/mypage/_components/ScreenMyPage.tsx @@ -860,10 +860,23 @@ const ScreenMyPage = ({ initialProfile }: ScreenMyPageProps) => { {/* โ”€โ”€ ํƒˆํ‡ดํ•˜๊ธฐ โ”€โ”€ */}