From bdd4e681677b8a4356c689aa422139fad9eb122a Mon Sep 17 00:00:00 2001 From: sscoderati Date: Fri, 24 Nov 2023 15:07:19 +0900 Subject: [PATCH 01/11] =?UTF-8?q?=E2=9C=A8=20Feat(#239):=20=ED=95=9C?= =?UTF-8?q?=EC=A4=84=20=EC=86=8C=EA=B0=9C=20Input=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - onChange에 onValueChange 등록 및 아이콘 제거 --- src/components/_common/Input/index.tsx | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/components/_common/Input/index.tsx b/src/components/_common/Input/index.tsx index de52acbf..0aa2890e 100644 --- a/src/components/_common/Input/index.tsx +++ b/src/components/_common/Input/index.tsx @@ -1,6 +1,4 @@ import type { ComponentProps } from "react"; -import { Pencil1Icon } from "@radix-ui/react-icons"; -import { IconButton } from "@radix-ui/themes"; interface InputProps extends ComponentProps<"input"> { inputName: @@ -46,6 +44,7 @@ const Input = ({ onChange={(event) => { onValueChange?.(event.target.value); }} + {...props} /> ); @@ -109,20 +108,17 @@ const Input = ({ break; case "introduce-input": input = ( -
+
{ + onValueChange?.(event.target.value); + }} + {...props} /> - - -
); break; From 0caffcc49a3c6e3ed7fbb80941aa41829d546927 Mon Sep 17 00:00:00 2001 From: sscoderati Date: Fri, 24 Nov 2023 15:08:51 +0900 Subject: [PATCH 02/11] =?UTF-8?q?=F0=9F=93=9D=20Chore(#239):=20positionsAn?= =?UTF-8?q?dStacksSchema=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 필드 이름 뒤에 Id 추가 --- .../LoginStepsContents/SetPositionAndStacks.tsx | 10 +++++----- src/schemas/setNickname.ts | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/_common/Modal/LoginModal/LoginStepsContents/SetPositionAndStacks.tsx b/src/components/_common/Modal/LoginModal/LoginStepsContents/SetPositionAndStacks.tsx index 71513db5..9cf989f8 100644 --- a/src/components/_common/Modal/LoginModal/LoginStepsContents/SetPositionAndStacks.tsx +++ b/src/components/_common/Modal/LoginModal/LoginStepsContents/SetPositionAndStacks.tsx @@ -20,7 +20,7 @@ const SetPositionAndStacks = () => { const { nickname, positionId, stacksId, setPositionId, setStackIds } = useNewUserInfoStore(); const userInfos = useForm({ - values: { position: positionId, stacks: stacksId }, + values: { positionId: positionId, stacksId: stacksId }, resolver: zodResolver(positionAndStacksSchema), }); const { data: stacksData } = useSuspenseQuery({ @@ -35,8 +35,8 @@ const SetPositionAndStacks = () => { }); const savePositionAndStacks = (data: PositionAndStacksSchemaType) => { - setPositionId(data.position); - setStackIds(data.stacks); + setPositionId(data.positionId); + setStackIds(data.stacksId); setIncreaseSteps(); }; @@ -61,7 +61,7 @@ const SetPositionAndStacks = () => {
( {
( value.length > 0, { From 2e6f6323d8d625ac1376a2357d8d25c8db482628 Mon Sep 17 00:00:00 2001 From: sscoderati Date: Fri, 24 Nov 2023 15:07:19 +0900 Subject: [PATCH 03/11] =?UTF-8?q?=E2=9C=A8=20Feat(#239):=20=ED=95=9C?= =?UTF-8?q?=EC=A4=84=20=EC=86=8C=EA=B0=9C=20Input=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - onChange에 onValueChange 등록 및 아이콘 제거 --- src/components/_common/Input/index.tsx | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/components/_common/Input/index.tsx b/src/components/_common/Input/index.tsx index de52acbf..0aa2890e 100644 --- a/src/components/_common/Input/index.tsx +++ b/src/components/_common/Input/index.tsx @@ -1,6 +1,4 @@ import type { ComponentProps } from "react"; -import { Pencil1Icon } from "@radix-ui/react-icons"; -import { IconButton } from "@radix-ui/themes"; interface InputProps extends ComponentProps<"input"> { inputName: @@ -46,6 +44,7 @@ const Input = ({ onChange={(event) => { onValueChange?.(event.target.value); }} + {...props} />
); @@ -109,20 +108,17 @@ const Input = ({ break; case "introduce-input": input = ( -
+
{ + onValueChange?.(event.target.value); + }} + {...props} /> - - -
); break; From 8760290f77673215df25d605617ce1625ba363d0 Mon Sep 17 00:00:00 2001 From: sscoderati Date: Fri, 24 Nov 2023 15:08:51 +0900 Subject: [PATCH 04/11] =?UTF-8?q?=F0=9F=93=9D=20Chore(#239):=20positionsAn?= =?UTF-8?q?dStacksSchema=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 필드 이름 뒤에 Id 추가 --- .../LoginStepsContents/SetPositionAndStacks.tsx | 10 +++++----- src/schemas/setNickname.ts | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/_common/Modal/LoginModal/LoginStepsContents/SetPositionAndStacks.tsx b/src/components/_common/Modal/LoginModal/LoginStepsContents/SetPositionAndStacks.tsx index 71513db5..9cf989f8 100644 --- a/src/components/_common/Modal/LoginModal/LoginStepsContents/SetPositionAndStacks.tsx +++ b/src/components/_common/Modal/LoginModal/LoginStepsContents/SetPositionAndStacks.tsx @@ -20,7 +20,7 @@ const SetPositionAndStacks = () => { const { nickname, positionId, stacksId, setPositionId, setStackIds } = useNewUserInfoStore(); const userInfos = useForm({ - values: { position: positionId, stacks: stacksId }, + values: { positionId: positionId, stacksId: stacksId }, resolver: zodResolver(positionAndStacksSchema), }); const { data: stacksData } = useSuspenseQuery({ @@ -35,8 +35,8 @@ const SetPositionAndStacks = () => { }); const savePositionAndStacks = (data: PositionAndStacksSchemaType) => { - setPositionId(data.position); - setStackIds(data.stacks); + setPositionId(data.positionId); + setStackIds(data.stacksId); setIncreaseSteps(); }; @@ -61,7 +61,7 @@ const SetPositionAndStacks = () => {
( {
( value.length > 0, { From a9a5e0cd698a0c518ae36322bfeaf6f28e887af0 Mon Sep 17 00:00:00 2001 From: sscoderati Date: Fri, 24 Nov 2023 15:10:21 +0900 Subject: [PATCH 05/11] =?UTF-8?q?=F0=9F=93=9D=20Chore(#239):=20=ED=94=84?= =?UTF-8?q?=EB=A1=9C=ED=95=84=20=EC=88=98=EC=A0=95=20api=20=EC=9A=94?= =?UTF-8?q?=EC=B2=AD=20=ED=95=A8=EC=88=98=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 잘못된 요청 경로 수정 --- src/services/user/updateMyProfile.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/services/user/updateMyProfile.ts b/src/services/user/updateMyProfile.ts index 05ffa040..f8b99d48 100644 --- a/src/services/user/updateMyProfile.ts +++ b/src/services/user/updateMyProfile.ts @@ -3,10 +3,7 @@ import type { UpdateMyProfileType } from "../types"; const updateMyProfile = async (payload: UpdateMyProfileType) => { try { - const response = await axiosInstance.patch( - "/api/v1/users/profile", - payload, - ); + const response = await axiosInstance.patch("/api/v1/user/profile", payload); if (isAbnormalCode(response.status)) { throw new Error("Failed to fetch update my profile api!"); } From 0c282c64050a6516bf768843d7dc23ceb99a5bba Mon Sep 17 00:00:00 2001 From: sscoderati Date: Fri, 24 Nov 2023 15:10:51 +0900 Subject: [PATCH 06/11] =?UTF-8?q?=E2=9C=A8=20Feat(#239):=20=ED=9A=8C?= =?UTF-8?q?=EC=9B=90=20=ED=83=88=ED=87=B4=20api=20=EC=9A=94=EC=B2=AD=20?= =?UTF-8?q?=ED=95=A8=EC=88=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/services/user/deleteMyProfile.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/services/user/deleteMyProfile.ts diff --git a/src/services/user/deleteMyProfile.ts b/src/services/user/deleteMyProfile.ts new file mode 100644 index 00000000..b0af5a04 --- /dev/null +++ b/src/services/user/deleteMyProfile.ts @@ -0,0 +1,16 @@ +import { axiosInstance, isAbnormalCode } from ".."; + +const deleteMyProfile = async () => { + try { + const response = await axiosInstance.delete("/api/v1/user"); + if (isAbnormalCode(response.status)) { + throw new Error("Failed to fetch delete my profile api!"); + } + return response.data; + } catch (error) { + console.error(error); + throw error; + } +}; + +export default deleteMyProfile(); From 85f57f44ba484943c67a0ee4817dae7b8387d18f Mon Sep 17 00:00:00 2001 From: sscoderati Date: Fri, 24 Nov 2023 15:11:29 +0900 Subject: [PATCH 07/11] =?UTF-8?q?=E2=9C=A8=20Feat(#239):=20=EC=9C=A0?= =?UTF-8?q?=EC=A0=80=20=ED=95=9C=EC=A4=84=20=EC=86=8C=EA=B0=9C=20=EC=8A=A4?= =?UTF-8?q?=ED=82=A4=EB=A7=88=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/schemas/userBioSchema.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/schemas/userBioSchema.ts diff --git a/src/schemas/userBioSchema.ts b/src/schemas/userBioSchema.ts new file mode 100644 index 00000000..903fdece --- /dev/null +++ b/src/schemas/userBioSchema.ts @@ -0,0 +1,11 @@ +import * as z from "zod"; + +export const userBioSchema = z.object({ + bio: z + .string({ required_error: "한 줄 소개를 입력해주세요." }) + .refine((value) => value.trim().length <= 80, { + message: "한 줄 소개는 80자 이하여야 합니다.", + }), +}); + +export type UserBioType = z.infer; From daf407630bb6d1188f8872e8678314b129b43381 Mon Sep 17 00:00:00 2001 From: sscoderati Date: Fri, 24 Nov 2023 15:32:50 +0900 Subject: [PATCH 08/11] =?UTF-8?q?=E2=9C=A8=20Feat(#239):=20=EB=A7=88?= =?UTF-8?q?=EC=9D=B4=ED=8E=98=EC=9D=B4=EC=A7=80=20api=20=EC=97=B0=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 프로필 수정 기능 연동 완료 - 회원 탈퇴 기능 연동 완료 --- src/app/(user-menu)/mypage/page.tsx | 479 +++++++++++++++++++++++++-- src/services/user/deleteMyProfile.ts | 2 +- 2 files changed, 446 insertions(+), 35 deletions(-) diff --git a/src/app/(user-menu)/mypage/page.tsx b/src/app/(user-menu)/mypage/page.tsx index e829662a..6c923137 100644 --- a/src/app/(user-menu)/mypage/page.tsx +++ b/src/app/(user-menu)/mypage/page.tsx @@ -1,13 +1,36 @@ "use client"; import { useState } from "react"; +import { useForm } from "react-hook-form"; import Image from "next/image"; +import { useRouter } from "next/navigation"; +import { Form, FormField, FormItem, FormMessage } from "@/components/ui/form"; +import { useToast } from "@/components/ui/use-toast"; import Logo from "@/images/logo.svg"; import { cn } from "@/lib/utils"; +import type { + NicknameSchemaType, + PositionAndStacksSchemaType, +} from "@/schemas/setNickname"; +import { nicknameSchema, positionAndStacksSchema } from "@/schemas/setNickname"; +import { userBioSchema } from "@/schemas/userBioSchema"; +import { zodResolver } from "@hookform/resolvers/zod"; +import { ResetIcon } from "@radix-ui/react-icons"; +import { Badge } from "@radix-ui/themes"; +import { useMutation, useSuspenseQuery } from "@tanstack/react-query"; +import getPositions from "@/services/steady/getPositions"; +import getStacks from "@/services/steady/getStacks"; +import type { UpdateMyProfileType } from "@/services/types"; +import checkSameNickname from "@/services/user/checkSameNickname"; +import deleteMyProfile from "@/services/user/deleteMyProfile"; +import getMyProfile from "@/services/user/getMyProfile"; +import updateMyProfile from "@/services/user/updateMyProfile"; import Button, { buttonSize } from "@/components/_common/Button"; import Icon from "@/components/_common/Icon"; import Input from "@/components/_common/Input"; import { AlertModal } from "@/components/_common/Modal"; +import { MultiSelector, SingleSelector } from "@/components/_common/Selector"; +import { extractValue } from "@/utils/extractValue"; import { subMyPageTextStyles } from "@/constants/commonStyle"; const subContentStyles = "flex flex-col gap-30"; @@ -15,10 +38,155 @@ const subBoxStyles = "px-30 py-20 gap-30 flex h-116 w-718 items-center rounded-6 border-2 border-st-gray-100"; const MyProfilePage = () => { - const [edit, setEdit] = useState(false); + const [isEditingNickname, setIsEditingNickname] = useState(false); + const [isEditingBio, setIsEditingBio] = useState(false); + const [isEditingPosition, setIsEditingPosition] = useState(false); + const [isEditingStacks, setIsEditingStacks] = useState(false); + const [sameNicknameChecked, setSameNicknameChecked] = useState(false); - const handleClick = () => { - setEdit((prev) => !prev); + const { toast } = useToast(); + const router = useRouter(); + + const { + data: myProfileData, + isPending: myProfileIsLoading, + error: myProfileError, + refetch: myProfileRefetch, + } = useSuspenseQuery({ + queryKey: ["profile"], + queryFn: () => getMyProfile(), + }); + + const profileMutation = useMutation({ + mutationKey: ["profile"], + mutationFn: (data: UpdateMyProfileType) => updateMyProfile(data), + onSuccess: () => { + toast({ description: "프로필 수정에 성공했습니다.", variant: "green" }); + myProfileRefetch(); + }, + onError: () => { + toast({ description: "프로필 수정에 실패했습니다.", variant: "red" }); + }, + }); + + const { data: stacksData } = useSuspenseQuery({ + queryKey: ["stacks"], + queryFn: () => getStacks(), + staleTime: Infinity, + }); + const { data: positionsData } = useSuspenseQuery({ + queryKey: ["positions"], + queryFn: () => getPositions(), + staleTime: Infinity, + }); + // TODO: 프로필 이미지 업로드 기능 구현 + const { nickname, bio, position, stacks, platform } = myProfileData; + + const nicknameForm = useForm({ + mode: "onChange", + resolver: zodResolver(nicknameSchema), + }); + + const positionAndStacksForm = useForm({ + mode: "onChange", + values: { + positionId: position.id, + stacksId: stacks.map((stack) => stack.id), + }, + resolver: zodResolver(positionAndStacksSchema), + }); + + const userBioForm = useForm({ + mode: "onChange", + values: { bio: bio }, + resolver: zodResolver(userBioSchema), + }); + + if (myProfileError) { + return
에러가 발생했습니다.
; + } + + if (myProfileIsLoading) { + return
로딩중...
; + } + + const handleCheckSameNickname = (nickname: string) => { + checkSameNickname(nickname) + .then((res) => { + if (res.exist) { + toast({ description: "이미 사용중인 닉네임입니다.", variant: "red" }); + return; + } else { + toast({ description: "사용 가능한 닉네임입니다!", variant: "green" }); + setSameNicknameChecked(true); + } + }) + .catch((error) => { + console.error(error); + toast({ + description: "닉네임 중복 확인에 실패했습니다.", + variant: "red", + }); + }); + return; + }; + + const handleUpdateNickName = (data: { nickname: string }) => { + if (!sameNicknameChecked) { + toast({ description: "닉네임 중복 확인을 해주세요.", variant: "red" }); + return; + } else { + const newData = { + nickname: data.nickname, + bio: myProfileData.bio, + profileImage: myProfileData.profileImage, + positionId: myProfileData.position.id, + stacksId: myProfileData.stacks.map((stack) => stack.id), + }; + profileMutation.mutate(newData); + setSameNicknameChecked(false); + setIsEditingNickname(false); + } + }; + + const handleUpdatePositionsAndStacks = ( + data: PositionAndStacksSchemaType, + ) => { + const newData = { + nickname: myProfileData.nickname, + bio: myProfileData.bio, + profileImage: myProfileData.profileImage, + ...data, + }; + profileMutation.mutate(newData); + }; + + const stacksInitialData = stacks.map((stack) => ({ + label: stack.name, + value: stack.id.toString(), + })); + + const handleUpdateBio = (data: { bio: string }) => { + const newData = { + nickname: myProfileData.nickname, + bio: data.bio, + profileImage: myProfileData.profileImage, + positionId: myProfileData.position.id, + stacksId: myProfileData.stacks.map((stack) => stack.id), + }; + profileMutation.mutate(newData); + setIsEditingBio(false); + }; + + const handleDeleteAccount = async () => { + deleteMyProfile.then((res) => { + if (res.status === 204) { + toast({ description: "회원 탈퇴에 성공했습니다.", variant: "green" }); + router.replace("/logout"); + } else { + toast({ description: "회원 탈퇴에 실패했습니다.", variant: "red" }); + } + }); }; return ( @@ -56,25 +224,69 @@ const MyProfilePage = () => { className="hidden" />
- {edit ? ( -
- - {/* 닉네임 중복 확인 */} - - + { + nicknameForm.reset(); + setSameNicknameChecked(false); + setIsEditingNickname(false); + }} + width={22} + height={22} + /> + + ) : ( + + )} +
+ +
+ )} /> - -
+ + ) : ( <> {/* TODO: 닉네임 state로 관리 */} -
{"스테디"}
-
+
+
포지션 / 스택
+
+ +
+
+ {isEditingPosition ? ( + <> + ( + + ({ + value: position.id.toString(), + label: position.name, + }))} + onSelectedChange={(selected) => { + positionAndStacksForm.setValue( + "positionId", + Number(selected), + ); + }} + /> + + + )} + /> + + setIsEditingPosition(false)} + /> + + ) : ( + <> + {position.name} + + + )} +
+
+ {isEditingStacks ? ( + <> + ( + + ({ + value: stack.id.toString(), + label: stack.name, + }))} + onSelectedChange={(selected) => { + positionAndStacksForm.setValue( + "stacksId", + extractValue(selected).map(Number), + ); + }} + /> + + + )} + /> + + setIsEditingStacks(false)} + /> + + ) : ( + <> + {stacks.map((stack) => ( + + {stack.name} + + ))} + + + )} +
+
+
+ +
+
한 줄 소개
-
- -
+
+ + {isEditingBio ? ( + ( +
+ { + field.onChange(value); + }} + /> + + setIsEditingBio(false)} + /> +
+ )} + /> + ) : ( +
+ {bio} + +
+ )} + +
+
소셜 인증
- 카카오 로고 -
- 카카오 인증이 완료되었습니다. ✅ -
+ {platform === "KAKAO" && ( + <> + 카카오 로고 +
+ 카카오 인증이 완료되었습니다 ✅ +
+ + )}
@@ -117,14 +527,15 @@ const MyProfilePage = () => { 회원 탈퇴 } actionButton={ diff --git a/src/services/user/deleteMyProfile.ts b/src/services/user/deleteMyProfile.ts index b0af5a04..f5d2c092 100644 --- a/src/services/user/deleteMyProfile.ts +++ b/src/services/user/deleteMyProfile.ts @@ -6,7 +6,7 @@ const deleteMyProfile = async () => { if (isAbnormalCode(response.status)) { throw new Error("Failed to fetch delete my profile api!"); } - return response.data; + return response; } catch (error) { console.error(error); throw error; From 56869383ddee6a3a21a14df273fcc40f1273b0a0 Mon Sep 17 00:00:00 2001 From: sscoderati Date: Fri, 24 Nov 2023 16:09:11 +0900 Subject: [PATCH 09/11] =?UTF-8?q?=F0=9F=9A=A8=20Fix(#239):=20Build=20?= =?UTF-8?q?=EC=97=90=EB=9F=AC=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 빌드 에러는 해결됐지만 올바른 방법인지 검증 필요ㅛ --- src/app/(auth)/api/login/route.ts | 2 -- src/app/(user-menu)/mypage/page.tsx | 15 +++++++-------- src/app/layout.tsx | 2 ++ 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/app/(auth)/api/login/route.ts b/src/app/(auth)/api/login/route.ts index 786f5a89..f7306c13 100644 --- a/src/app/(auth)/api/login/route.ts +++ b/src/app/(auth)/api/login/route.ts @@ -1,8 +1,6 @@ import { cookies } from "next/headers"; import type { NextRequest } from "next/server"; -export const dynamic = "force-dynamic"; - export async function POST(req: NextRequest) { try { const { token } = await req.json(); diff --git a/src/app/(user-menu)/mypage/page.tsx b/src/app/(user-menu)/mypage/page.tsx index 6c923137..904ca3b3 100644 --- a/src/app/(user-menu)/mypage/page.tsx +++ b/src/app/(user-menu)/mypage/page.tsx @@ -179,14 +179,13 @@ const MyProfilePage = () => { }; const handleDeleteAccount = async () => { - deleteMyProfile.then((res) => { - if (res.status === 204) { - toast({ description: "회원 탈퇴에 성공했습니다.", variant: "green" }); - router.replace("/logout"); - } else { - toast({ description: "회원 탈퇴에 실패했습니다.", variant: "red" }); - } - }); + const res = await deleteMyProfile; + if (res.status === 204) { + toast({ description: "회원 탈퇴에 성공했습니다.", variant: "green" }); + router.replace("/logout"); + } else { + toast({ description: "회원 탈퇴에 실패했습니다.", variant: "red" }); + } }; return ( diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 77aad581..dc3367de 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -9,6 +9,8 @@ import AppBar from "@/components/_common/AppBar"; import Footer from "@/components/_common/Footer"; import "./global.css"; +export const dynamic = "force-dynamic"; + export const metadata: Metadata = { title: "Steady", description: "The New Study & Project Join Platform", From f4dca65e22bdc951166530ab49951562368c465e Mon Sep 17 00:00:00 2001 From: sscoderati Date: Fri, 24 Nov 2023 16:57:24 +0900 Subject: [PATCH 10/11] =?UTF-8?q?=F0=9F=9A=A8=20Fix(#239):=20=EB=A7=88?= =?UTF-8?q?=EC=9D=B4=ED=8E=98=EC=9D=B4=EC=A7=80=EC=97=90=20=EC=A7=84?= =?UTF-8?q?=EC=9E=85=EB=A7=8C=20=ED=95=B4=EB=8F=84=20=ED=9A=8C=EC=9B=90=20?= =?UTF-8?q?=ED=83=88=ED=87=B4=20=EB=90=98=EB=8A=94=20=EB=AC=B8=EC=A0=9C=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 - 회원 탈퇴 api 요청 함수 export에서 호출부분 제거 - 그 외 한줄 소개 null일 시 보여줄 대체 문구 추가 --- src/app/(user-menu)/mypage/page.tsx | 22 +++++++++++++--------- src/app/layout.tsx | 2 -- src/services/user/deleteMyProfile.ts | 2 +- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/app/(user-menu)/mypage/page.tsx b/src/app/(user-menu)/mypage/page.tsx index 904ca3b3..94b85341 100644 --- a/src/app/(user-menu)/mypage/page.tsx +++ b/src/app/(user-menu)/mypage/page.tsx @@ -179,13 +179,14 @@ const MyProfilePage = () => { }; const handleDeleteAccount = async () => { - const res = await deleteMyProfile; - if (res.status === 204) { - toast({ description: "회원 탈퇴에 성공했습니다.", variant: "green" }); - router.replace("/logout"); - } else { - toast({ description: "회원 탈퇴에 실패했습니다.", variant: "red" }); - } + deleteMyProfile().then((res) => { + if (res.status === 204) { + toast({ description: "회원 탈퇴에 성공했습니다.", variant: "green" }); + router.replace("/logout"); + } else { + toast({ description: "회원 탈퇴에 실패했습니다.", variant: "red" }); + } + }); }; return ( @@ -480,7 +481,7 @@ const MyProfilePage = () => { "justify-center text-2xl italic text-st-gray-250", )} > - {bio} + {bio ?? "한 줄 소개를 입력해주세요."} diff --git a/src/app/layout.tsx b/src/app/layout.tsx index dc3367de..77aad581 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -9,8 +9,6 @@ import AppBar from "@/components/_common/AppBar"; import Footer from "@/components/_common/Footer"; import "./global.css"; -export const dynamic = "force-dynamic"; - export const metadata: Metadata = { title: "Steady", description: "The New Study & Project Join Platform", diff --git a/src/services/user/deleteMyProfile.ts b/src/services/user/deleteMyProfile.ts index f5d2c092..846e283b 100644 --- a/src/services/user/deleteMyProfile.ts +++ b/src/services/user/deleteMyProfile.ts @@ -13,4 +13,4 @@ const deleteMyProfile = async () => { } }; -export default deleteMyProfile(); +export default deleteMyProfile; From 172826ae0a5647bd008e390e4fd6a03a53656ab9 Mon Sep 17 00:00:00 2001 From: sscoderati Date: Fri, 24 Nov 2023 17:12:46 +0900 Subject: [PATCH 11/11] =?UTF-8?q?=F0=9F=93=9D=20Chore(#239):=20=EB=B6=88?= =?UTF-8?q?=ED=95=84=EC=9A=94=ED=95=9C=20async=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/(user-menu)/mypage/page.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/(user-menu)/mypage/page.tsx b/src/app/(user-menu)/mypage/page.tsx index 94b85341..15775498 100644 --- a/src/app/(user-menu)/mypage/page.tsx +++ b/src/app/(user-menu)/mypage/page.tsx @@ -178,7 +178,7 @@ const MyProfilePage = () => { setIsEditingBio(false); }; - const handleDeleteAccount = async () => { + const handleDeleteAccount = () => { deleteMyProfile().then((res) => { if (res.status === 204) { toast({ description: "회원 탈퇴에 성공했습니다.", variant: "green" });