From f73fbddca38ca6d8217d91be793b1650b5cb8bcb Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 22 Feb 2025 17:08:08 +0900 Subject: [PATCH 01/14] =?UTF-8?q?feat:=20=EC=A7=80=EC=97=AD=20=EC=8A=A4?= =?UTF-8?q?=ED=81=AC=EB=A1=A4=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/features/DetailMaker.tsx | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/features/DetailMaker.tsx b/src/features/DetailMaker.tsx index a4087c6..7b92206 100644 --- a/src/features/DetailMaker.tsx +++ b/src/features/DetailMaker.tsx @@ -331,13 +331,16 @@ export default function RequestDetailDreamer() {

서비스 가능 지역

- - +
+
+ +
+
From c1bdc1d0e21643fd64bf90227e99c23b04860f34 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 22 Feb 2025 17:39:34 +0900 Subject: [PATCH 02/14] =?UTF-8?q?feat:=20=EB=A7=B5=20=EB=A7=88=EC=BB=A4=20?= =?UTF-8?q?=EC=A0=84=EC=B2=B4=20=ED=86=B5=EA=B3=84=20=EB=B3=B4=EC=9D=B4?= =?UTF-8?q?=EA=B2=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/icon_refresh.svg | 13 +++++++++++++ src/components/Landing/MapMarker.tsx | 15 ++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 public/assets/icon_refresh.svg diff --git a/public/assets/icon_refresh.svg b/public/assets/icon_refresh.svg new file mode 100644 index 0000000..9a8b7b7 --- /dev/null +++ b/public/assets/icon_refresh.svg @@ -0,0 +1,13 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/components/Landing/MapMarker.tsx b/src/components/Landing/MapMarker.tsx index e774c30..8170e35 100644 --- a/src/components/Landing/MapMarker.tsx +++ b/src/components/Landing/MapMarker.tsx @@ -5,6 +5,8 @@ import { ComposableMap, Geographies, Geography, Marker } from "react-simple-maps import { PieChart, Pie, Tooltip, Cell } from "recharts"; import planService from "@/services/planService"; import planData from "@/types/planData"; +import Image from "next/image"; +import refresh_icon from "@public/assets/icon_refresh.svg"; const regionNames = planData.locations.reduce( (acc, { name, mapping }) => { @@ -161,7 +163,17 @@ export default function MapMarker() {
{selectedRegion ? ( <> -

{regionNames[selectedRegion.name]} 통계

+
+

+ {regionNames[selectedRegion.name]} 통계 +

+
+ +
+
+

총 서비스 수: {selectedRegion.totalCount}

{selectedRegion.totalCount === 0 ? (
@@ -189,6 +201,7 @@ export default function MapMarker() { )} +

마커를 클릭하면 해당 지역 통계를 볼 수 있습니다.

) : ( From b1833cae5aeb9633a9e4aadd0c327a1129cdbad4 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 22 Feb 2025 17:59:31 +0900 Subject: [PATCH 03/14] =?UTF-8?q?feat:=20=EC=B1=97=EB=A3=B8=20=ED=81=B4?= =?UTF-8?q?=EB=A6=AD=20=EC=95=88=ED=96=88=EC=9D=84=20=EC=8B=9C=20=EC=83=9D?= =?UTF-8?q?=EA=B8=B0=EB=8A=94=20=EB=A7=88=EC=A7=84=20=EB=AC=B8=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/features/ChattingForm.tsx | 42 ++++++++--------------------------- 1 file changed, 9 insertions(+), 33 deletions(-) diff --git a/src/features/ChattingForm.tsx b/src/features/ChattingForm.tsx index 9e2e3d8..4f4f6b9 100644 --- a/src/features/ChattingForm.tsx +++ b/src/features/ChattingForm.tsx @@ -1,7 +1,7 @@ import Layout from "@/components/Common/Layout"; import Bubble from "@/components/Common/Bubble"; import { useCallback, useEffect, useRef, useState } from "react"; -import { useQuery, useQueryClient } from "@tanstack/react-query"; +import { useQuery } from "@tanstack/react-query"; import { ChatRoom, Message } from "@/types/chatData"; import { getAccessToken } from "@/utils/tokenUtils"; import { formatToDetailedDate } from "@/utils/formatDate"; @@ -36,7 +36,6 @@ export default function ChattingForm() { const [isFirstMessage, setIsFirstMessage] = useState(false); const [hasMoreMessages, setHasMoreMessages] = useState(true); const [messageToDelete, setMessageToDelete] = useState(null); - const [isMessageLoading, setIsMessageLoading] = useState(false); const messagesEndRef = useRef(null); const messagesContainerRef = useRef(null); @@ -52,8 +51,6 @@ export default function ChattingForm() { }, }); - const queryClient = useQueryClient(); - const handleKeyDown = (e: React.KeyboardEvent) => { if (e.key === "Enter") { e.preventDefault(); @@ -86,12 +83,6 @@ export default function ChattingForm() { await handleFileUpload(selectedChatRoom.id, file, newMessage); } else { chatService.sendMessage(socket, selectedChatRoom.id, message.trim(), "TEXT"); - queryClient.setQueryData(["chatRooms"], (oldData: ChatRoom[] | undefined) => { - if (!oldData) return []; - return oldData.map((room) => - room.id === selectedChatRoom.id ? { ...room, lastChat: message.trim() } : room, - ); - }); setMessages((prevMessages) => [newMessage, ...prevMessages]); } @@ -178,7 +169,6 @@ export default function ChattingForm() { }, [selectedChatRoom, handleScroll]); const fetchMessages = async (chatRoomId: string, currentPage: number, isOldMessages = false) => { - setIsMessageLoading(true); try { const data = await chatService.getMessages(chatRoomId, currentPage, 10); if (data.length === 0) { @@ -209,8 +199,6 @@ export default function ChattingForm() { } } catch (error: any) { alert(error.message); - } finally { - setIsMessageLoading(false); } }; @@ -368,20 +356,12 @@ export default function ChattingForm() { const newSocket = chatService.connectWebSocket( accessToken, (newMessage: Message) => { - queryClient.setQueryData(["chatRooms"], (oldData = []) => { - return oldData.map((room) => - room.id === newMessage.chatRoomId ? { ...room, lastChat: newMessage.content } : room, - ); + setMessages((prevMessages) => { + if (!prevMessages.find((msg) => msg.id === newMessage.id)) { + return [newMessage, ...prevMessages]; + } + return prevMessages; }); - - if (newMessage.chatRoomId === selectedChatRoom?.id) { - setMessages((prevMessages) => { - if (!prevMessages.find((msg) => msg.id === newMessage.id)) { - return [newMessage, ...prevMessages]; - } - return prevMessages; - }); - } }, handleError, ); @@ -490,7 +470,7 @@ export default function ChattingForm() { return ( <> -
+

메시지

@@ -585,7 +565,7 @@ export default function ChattingForm() { 코코넛

- {selectedChatRoom?.quotePrice} P + {selectedChatRoom?.quotePrice} 개

@@ -594,11 +574,6 @@ export default function ChattingForm() { className="h-[600px] overflow-y-auto mobile-tablet:h-[650px]" ref={messagesContainerRef} > - {isMessageLoading && ( -
- 로딩중 -
- )} {renderMessages()}
@@ -634,6 +609,7 @@ export default function ChattingForm() { {filePreview &&
{renderFilePreview()}
}
+
{selectedChatRoom === null ?
: ""}
)} From 43a89fa9af9738c4dce1407cfd42e9c415969885 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 22 Feb 2025 21:42:38 +0900 Subject: [PATCH 04/14] test --- src/components/Common/DreamerFilter.tsx | 114 ++++++++++++------------ src/features/ChattingForm.tsx | 2 +- 2 files changed, 57 insertions(+), 59 deletions(-) diff --git a/src/components/Common/DreamerFilter.tsx b/src/components/Common/DreamerFilter.tsx index cccd153..d4d13cb 100644 --- a/src/components/Common/DreamerFilter.tsx +++ b/src/components/Common/DreamerFilter.tsx @@ -1,38 +1,46 @@ -import React, { useState, useEffect, useRef } from 'react'; -import Image from 'next/image'; -import downBlue from '@public/assets/dropdown_down_blue.svg'; -import downGray from '@public/assets/dropdown_down_gray.svg'; +import React, { useState, useEffect, useRef } from "react"; +import Image from "next/image"; +import downBlue from "@public/assets/dropdown_down_blue.svg"; +import downGray from "@public/assets/dropdown_down_gray.svg"; -const placeholder = '지역'; -const items = ['전체', '서울', '경기', '인천', '강원', '충북', '충남', '세종', '대전', '전북']; -const placeholder2 = '서비스'; -const items2 = ['전체', '기념품/쇼핑형', '맛집 탐방형', '액티비티/탐험형', '문화/역사탐방형', '축제참여형', '휴양형']; +const placeholder = "지역"; +const items = ["전체", "서울", "경기", "인천", "강원", "충북", "충남", "세종", "대전", "전북"]; +const placeholder2 = "서비스"; +const items2 = [ + "전체", + "기념품/쇼핑형", + "맛집 탐방형", + "액티비티/탐험형", + "문화/역사탐방형", + "축제참여형", + "휴양형", +]; const serviceTypeMapping: Record = { - '전체': '', - '기념품/쇼핑형': 'SHOPPING', - '맛집 탐방형': 'FOOD_TOUR', - '액티비티/탐험형': 'ACTIVITY', - '문화/역사탐방형': 'CULTURE', - '축제참여형': 'FESTIVAL', - '휴양형': 'RELAXATION', + 전체: "", + "기념품/쇼핑형": "SHOPPING", + "맛집 탐방형": "FOOD_TOUR", + "액티비티/탐험형": "ACTIVITY", + "문화/역사탐방형": "CULTURE", + 축제참여형: "FESTIVAL", + 휴양형: "RELAXATION", }; const areaMapping: Record = { - '전체': '', - '서울': 'SEOUL', - '경기': 'GYEONGGI', - '인천': 'INCHEON', - '강원': 'GANGWON', - '충북': 'CHUNGBUK', - '충남': 'CHUNGNAM', - '세종': 'SEJONG', - '대전': 'DAEJEON', - '전북': 'JEONBUK', + 전체: "", + 서울: "SEOUL", + 경기: "GYEONGGI", + 인천: "INCHEON", + 강원: "GANGWON", + 충북: "CHUNGBUK", + 충남: "CHUNGNAM", + 세종: "SEJONG", + 대전: "DAEJEON", + 전북: "JEONBUK", }; interface DreamerFilterProps { - type: 'location' | 'service'; + type: "location" | "service"; reset: boolean; onSelect: (selectedItem: string) => void; } @@ -59,67 +67,57 @@ const DreamerFilter = ({ type, reset, onSelect }: DreamerFilterProps) => { }; useEffect(() => { - document.addEventListener('mousedown', handleClickOutside); + document.addEventListener("mousedown", handleClickOutside); return () => { - document.removeEventListener('mousedown', handleClickOutside); + document.removeEventListener("mousedown", handleClickOutside); }; }, []); - const itemsToDisplay = type === 'location' ? items : items2; - const placeholderText = type === 'location' ? placeholder : placeholder2; + const itemsToDisplay = type === "location" ? items : items2; + const placeholderText = type === "location" ? placeholder : placeholder2; const handleItemClick = (item: string) => { if (itemsToDisplay.includes(item)) { setSelectedItem(item); setIsOpen(false); - const mappedValue = type === 'service' ? serviceTypeMapping[item] : areaMapping[item]; + const mappedValue = type === "service" ? serviceTypeMapping[item] : areaMapping[item]; onSelect(mappedValue); } }; return ( -
+
{isOpen && ( -
-
- {itemsToDisplay.map(item => ( +
+
+ {itemsToDisplay.map((item) => ( @@ -131,4 +129,4 @@ const DreamerFilter = ({ type, reset, onSelect }: DreamerFilterProps) => { ); }; -export default DreamerFilter; \ No newline at end of file +export default DreamerFilter; diff --git a/src/features/ChattingForm.tsx b/src/features/ChattingForm.tsx index 4f4f6b9..f7e4134 100644 --- a/src/features/ChattingForm.tsx +++ b/src/features/ChattingForm.tsx @@ -470,7 +470,7 @@ export default function ChattingForm() { return ( <> -
+

메시지

From 8c9bbfc89662e80b2635c2b81159424fc112a870 Mon Sep 17 00:00:00 2001 From: Yang ga-hyeon Date: Sat, 22 Feb 2025 21:52:14 +0900 Subject: [PATCH 05/14] =?UTF-8?q?feat:=20=EB=A9=94=EC=8B=9C=EC=A7=80=20?= =?UTF-8?q?=EC=9C=84=EC=B9=98=20=EC=A1=B0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/features/ChattingForm.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/features/ChattingForm.tsx b/src/features/ChattingForm.tsx index f7e4134..c529c5b 100644 --- a/src/features/ChattingForm.tsx +++ b/src/features/ChattingForm.tsx @@ -471,7 +471,7 @@ export default function ChattingForm() { return ( <>
-

메시지

+

메시지

From 4db752b55377ef53ecab84bd8f5f91dbcafa653a Mon Sep 17 00:00:00 2001 From: Yang ga-hyeon Date: Sat, 22 Feb 2025 22:22:27 +0900 Subject: [PATCH 06/14] =?UTF-8?q?feat:=20maker=20=EA=B8=B0=EB=B3=B8?= =?UTF-8?q?=EC=A0=95=EB=B3=B4=20=EC=88=98=EC=A0=95=20=EB=B9=84=EB=B0=80?= =?UTF-8?q?=EB=B2=88=ED=98=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/features/InformEditMaker.tsx | 6 +++--- src/services/userService.ts | 4 ++-- src/utils/validate.ts | 30 +++++++++++++++++++++++------- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/src/features/InformEditMaker.tsx b/src/features/InformEditMaker.tsx index b333b40..68337d1 100644 --- a/src/features/InformEditMaker.tsx +++ b/src/features/InformEditMaker.tsx @@ -197,7 +197,7 @@ export default function InformEditMaker() { label="현재 비밀번호" placeholder="현재 비밀번호를 입력해 주세요" className="overflow-hidden text-ellipsis whitespace-nowrap border-0 bg-color-background-200 pr-10" - disabled={!isEmailExist} + disabled={!!errors.password} {...register("password")} />
@@ -210,9 +210,9 @@ export default function InformEditMaker() { className="overflow-hidden text-ellipsis whitespace-nowrap border-0 bg-color-background-200 pr-10" disabled={!isEmailExist} {...register("newPassword")} - error={!!errors.password} + error={!!errors.newPassword} /> - {errors.password && } + {errors.newPassword && }
diff --git a/src/services/userService.ts b/src/services/userService.ts index a550c0b..503bcdc 100644 --- a/src/services/userService.ts +++ b/src/services/userService.ts @@ -1,4 +1,4 @@ -import { UNAUTHORIZED } from "@/utils/errorStatus"; +import { BAD_REQUEST } from "@/utils/errorStatus"; import { api } from "./api"; type Role = "DREAMER" | "MAKER"; @@ -135,7 +135,7 @@ const userService = { try { await api.patch("/users/update", payload); } catch (error: any) { - if (error.response && error.response.status === UNAUTHORIZED) { + if (error.response && error.response.status === BAD_REQUEST) { throw new Error("기존 비밀번호와 일치하지 않습니다."); } } diff --git a/src/utils/validate.ts b/src/utils/validate.ts index 18bd6b3..cedc641 100644 --- a/src/utils/validate.ts +++ b/src/utils/validate.ts @@ -99,12 +99,28 @@ export const editMakerSchema = z export type EditMakerData = z.infer; -export const signUpOAuthSchema = z.object({ - nickName: z.string().min(1, { message: "닉네임을 입력해 주세요." }), - phoneNumber: z - .string() - .regex(/^010\d{8}$/, { message: "010으로 시작하고 숫자만 입력해 주세요." }), - role: z.enum(["MAKER", "DREAMER"], { message: "역할을 선택해 주세요." }), -}); +export const signUpOAuthSchema = z + .object({ + nickName: z.string().min(1, { message: "닉네임을 입력해 주세요." }), + phoneNumber: z + .string() + .regex(/^010\d{8}$/, { message: "010으로 시작하고 숫자만 입력해 주세요." }), + role: z.enum(["MAKER", "DREAMER"], { message: "역할을 선택해 주세요." }), + password: z.string().optional(), + newPassword: z.string().optional(), + newConfirmPassword: z.string().optional(), + }) + .refine((data) => !data.newPassword || data.password, { + path: ["password"], + message: "새 비밀번호를 설정하려면 현재 비밀번호를 입력해 주세요.", + }) + .refine((data) => !data.newPassword || data.newPassword.length >= 6, { + path: ["newPassword"], + message: "새 비밀번호는 최소 6자 이상이어야 합니다.", + }) + .refine((data) => !data.newPassword || data.newPassword === data.newConfirmPassword, { + path: ["newConfirmPassword"], + message: "새 비밀번호가 일치하지 않습니다.", + }); export type SignUpOAuthData = z.infer; From a9d776ca4753f7d6c5d21dc989ae6fd8a8f8dd7f Mon Sep 17 00:00:00 2001 From: Yang ga-hyeon Date: Sat, 22 Feb 2025 22:59:28 +0900 Subject: [PATCH 07/14] =?UTF-8?q?feat:=20=EC=9D=B4=EC=9A=A9=EC=84=9C?= =?UTF-8?q?=EB=B9=84=EC=8A=A4=20=ED=81=AC=EA=B8=B0=20=EA=B3=A0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Common/Selector.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Common/Selector.tsx b/src/components/Common/Selector.tsx index 6a6f432..64a597a 100644 --- a/src/components/Common/Selector.tsx +++ b/src/components/Common/Selector.tsx @@ -13,7 +13,7 @@ const Services = ({ className?: string; itemClassName?: string; }) => ( -
+
{(data || planData.services).map((service, index) => (
Date: Sat, 22 Feb 2025 23:05:46 +0900 Subject: [PATCH 08/14] =?UTF-8?q?feat:=20=EC=85=80=EB=A0=89=ED=84=B0=20?= =?UTF-8?q?=ED=81=AC=EA=B8=B0=20=EC=A1=B0=EC=A0=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Common/Selector.tsx | 7 ++++++- src/features/DetailMaker.tsx | 2 +- src/features/ProfileEditDreamer.tsx | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/Common/Selector.tsx b/src/components/Common/Selector.tsx index 64a597a..b32a90c 100644 --- a/src/components/Common/Selector.tsx +++ b/src/components/Common/Selector.tsx @@ -6,14 +6,16 @@ const Services = ({ data, className, itemClassName, + useWide, }: { selectedTypes: string[]; toggleSelection?: (type: string) => void; data?: Service[]; className?: string; itemClassName?: string; + useWide?: boolean; }) => ( -
+
{(data || planData.services).map((service, index) => (
@@ -86,6 +90,7 @@ export default function Selector({ data={data as Service[]} className={className} itemClassName={itemClassName} + useWide={useWide} /> )} {category === "locations" && ( diff --git a/src/features/DetailMaker.tsx b/src/features/DetailMaker.tsx index 7b92206..b67ab86 100644 --- a/src/features/DetailMaker.tsx +++ b/src/features/DetailMaker.tsx @@ -284,7 +284,7 @@ export default function RequestDetailDreamer() {

SNS

- + 링크 이미지
diff --git a/src/features/ProfileEditDreamer.tsx b/src/features/ProfileEditDreamer.tsx index 8aadce0..e305805 100644 --- a/src/features/ProfileEditDreamer.tsx +++ b/src/features/ProfileEditDreamer.tsx @@ -310,6 +310,7 @@ export default function ProfileEditDreamer() { planData.services.find((ser) => ser.mapping === service)?.name || service, )} toggleSelection={handleServiceSelection} + useWide={true} />
From fb95658448948b198c1fcd2c89c0a4078654dd18 Mon Sep 17 00:00:00 2001 From: Yang ga-hyeon Date: Sat, 22 Feb 2025 23:15:57 +0900 Subject: [PATCH 09/14] =?UTF-8?q?feat:=20sns=20=ED=81=B4=EB=A6=AD=20?= =?UTF-8?q?=EC=8B=9C=20url=EB=A1=9C=20=EB=84=98=EC=96=B4=EA=B0=80=EC=A7=80?= =?UTF-8?q?=20=EC=95=8A=EB=8A=94=20=EA=B2=BD=EC=9A=B0=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/features/DetailMaker.tsx | 16 +++++++++++++++- src/services/userService.ts | 8 +++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/features/DetailMaker.tsx b/src/features/DetailMaker.tsx index b67ab86..5e450c2 100644 --- a/src/features/DetailMaker.tsx +++ b/src/features/DetailMaker.tsx @@ -284,7 +284,21 @@ export default function RequestDetailDreamer() {

SNS

- + { + if (!makerProfileInfo?.gallery.startsWith("http")) { + e.preventDefault(); + alert("경력이 없습니다!"); + } + }} + > 링크 이미지
diff --git a/src/services/userService.ts b/src/services/userService.ts index 503bcdc..1ef22ea 100644 --- a/src/services/userService.ts +++ b/src/services/userService.ts @@ -1,4 +1,4 @@ -import { BAD_REQUEST } from "@/utils/errorStatus"; +import { BAD_REQUEST, CONFLICT } from "@/utils/errorStatus"; import { api } from "./api"; type Role = "DREAMER" | "MAKER"; @@ -191,8 +191,10 @@ const userService = { try { const response = await api.get(`/users/profile/${makerId}`); return response; - } catch (error) { - console.error("메이커 프로필 조회 실패", error); + } catch (error: any) { + if (error.response && error.response.status === BAD_REQUEST) { + throw new Error("존재하지 않은 사이트입니다!"); + } } }, From 31b4ef1fb20cdc39fa89795d988e1ebbf1adff52 Mon Sep 17 00:00:00 2001 From: Yang ga-hyeon Date: Sun, 23 Feb 2025 00:13:41 +0900 Subject: [PATCH 10/14] test --- package-lock.json | 69 ++++++++++++----------------- src/components/Gnb/NavBar.tsx | 20 +++------ src/features/LoginForm.tsx | 10 ++--- src/features/ProfileEditDreamer.tsx | 55 +++++++++++------------ src/pages/index.tsx | 4 +- 5 files changed, 67 insertions(+), 91 deletions(-) diff --git a/package-lock.json b/package-lock.json index 00190c5..a35712d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1489,17 +1489,6 @@ "node": ">= 8" } }, - "node_modules/anymatch/node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, "node_modules/arg": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz", @@ -2572,9 +2561,9 @@ } }, "node_modules/enhanced-resolve": { - "version": "5.18.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.18.0.tgz", - "integrity": "sha512-0/r0MySGYG8YqlayBZ6MuCfECmHFdJ5qyPh8s8wa5Hnm6SaFLSK1VYCbj+NKp090Nm1caZhD+QTnmxO7esYGyQ==", + "version": "5.18.1", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.18.1.tgz", + "integrity": "sha512-ZSW3ma5GkcQBIpwZTSRAI8N71Uuwgs93IezB7mf7R60tC8ZbJideoDNKjHn2O9KIlx6rkGTTEk1xUCK2E1Y2Yg==", "dev": true, "dependencies": { "graceful-fs": "^4.2.4", @@ -4197,11 +4186,14 @@ } }, "node_modules/jiti": { - "version": "1.21.7", - "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.7.tgz", - "integrity": "sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A==", + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-2.4.2.tgz", + "integrity": "sha512-rg9zJN+G4n2nfJl5MW3BMygZX56zKPNVEYYqq7adpmMh4Jn2QNEwhvQlFy6jPVdcod7txZtKHWnyZiA3a0zP7A==", + "dev": true, + "optional": true, + "peer": true, "bin": { - "jiti": "bin/jiti.js" + "jiti": "lib/jiti-cli.mjs" } }, "node_modules/js-tokens": { @@ -4419,17 +4411,6 @@ "node": ">=8.6" } }, - "node_modules/micromatch/node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, "node_modules/mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", @@ -4899,6 +4880,17 @@ "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==" }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/pify": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", @@ -5358,17 +5350,6 @@ "node": ">=8.10.0" } }, - "node_modules/readdirp/node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, "node_modules/recharts": { "version": "2.15.1", "resolved": "https://registry.npmjs.org/recharts/-/recharts-2.15.1.tgz", @@ -6259,6 +6240,14 @@ "node": ">=14.0.0" } }, + "node_modules/tailwindcss/node_modules/jiti": { + "version": "1.21.7", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.7.tgz", + "integrity": "sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A==", + "bin": { + "jiti": "bin/jiti.js" + } + }, "node_modules/tapable": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", diff --git a/src/components/Gnb/NavBar.tsx b/src/components/Gnb/NavBar.tsx index 3133faa..686a801 100644 --- a/src/components/Gnb/NavBar.tsx +++ b/src/components/Gnb/NavBar.tsx @@ -57,23 +57,14 @@ const getNotification = () => { }; const NavBar = () => { - const { - isLoggedIn, - nickName, - role, - coconut, - setCoconut, - email, - phoneNumber, - profileImage, - setLogin, - } = useAuthStore(); + const { isLoggedIn, nickName, role, coconut, setCoconut, email, phoneNumber, setLogin } = + useAuthStore(); const [isOpenSidebar, setIsOpenSidebar] = useState(false); const [isOpenNotification, setIsOpenNotification] = useState(false); const [isOpenUserMenu, setIsOpenUserMenu] = useState(false); const [userInfo, setUserInfo] = useState(null); const [notifications, setNotifications] = useState([]); - const [userImage, setUserImage] = useState(profileImage || user_img.src); + const [userImage, setUserImage] = useState(user_img.src); const userMenuRef = useRef(null); const notificationRef = useRef(null); const sideBarRef = useRef(null); @@ -163,11 +154,12 @@ const NavBar = () => { const fetchUserInfo = async () => { try { const userData = await userService.getUserInfo(); + const profileData = await userService.getProfileInfo(); setUserInfo(userData); - const avatarImage = avatarImages.find((avatar) => avatar.key === profileImage); + const avatarImage = avatarImages.find((avatar) => avatar.key === profileData.image); setUserImage(avatarImage ? avatarImage.src : user_img.src); - setLogin(nickName, role, coconut, email, phoneNumber, profileImage); + setLogin(nickName, role, coconut, email, phoneNumber); if (userData.coconut !== coconut) { handleCoconutChange(userData.coconut); } diff --git a/src/features/LoginForm.tsx b/src/features/LoginForm.tsx index 3e824be..1757277 100644 --- a/src/features/LoginForm.tsx +++ b/src/features/LoginForm.tsx @@ -80,12 +80,12 @@ export default function LoginForm() { const isFormValid = Object.values(watchFields).every((value) => value?.toString().trim() !== ""); const ErrorMessage = ({ message }: { message: string | undefined }) => ( -

{message}

+

{message}

); return (
-
+
로고
@@ -117,13 +117,13 @@ export default function LoginForm() { />
-
-

+

+

아직 니가가라하와이 회원이 아니신가요?

이메일로 회원가입하기 diff --git a/src/features/ProfileEditDreamer.tsx b/src/features/ProfileEditDreamer.tsx index e305805..f51425d 100644 --- a/src/features/ProfileEditDreamer.tsx +++ b/src/features/ProfileEditDreamer.tsx @@ -114,12 +114,7 @@ export default function ProfileEditDreamer() { alert("프로필이 성공적으로 수정되었습니다!"); if (userInfo?.nickName !== data.nickName) { - setLogin( - data.nickName, - userInfo?.role || "guest", - userInfo?.coconut || 0, - profileInfo.image, - ); + setLogin(data.nickName, userInfo?.role || "guest", userInfo?.coconut || 0); } router.reload(); } catch (error: any) { @@ -146,7 +141,7 @@ export default function ProfileEditDreamer() { })(); const ErrorMessage = ({ message }: { message: string | undefined }) => ( -

{message}

+

{message}

); useEffect(() => { @@ -179,9 +174,9 @@ export default function ProfileEditDreamer() { return ( <>

프로필 수정

-
+
-
+
{errors.nickName && } {nickNameMessage &&

{nickNameMessage}

}
-
+
-
+
{errors.phoneNumber && }
-
+
-
+
{errors.newPassword && }
-
+
-

프로필 이미지

+

프로필 이미지

setIsOpenImageModal(true)} className="w-[160px] cursor-pointer"> {profileImg ? ( setIsOpenImageModal(false)} /> )} -
+
-

이용 서비스

-

+

이용 서비스

+

* 플랜 요청 시 이용 서비스를 선택할 수 있어요.

-
+
-

여행 하고 싶은 지역

-

+

여행 하고 싶은 지역

+

* 플랜 요청 시 지역을 설정할 수 있어요.

-
+
-
{selectedChatRoom === null ?
: ""}
)} diff --git a/src/features/ProfileEditDreamer.tsx b/src/features/ProfileEditDreamer.tsx index f51425d..e305805 100644 --- a/src/features/ProfileEditDreamer.tsx +++ b/src/features/ProfileEditDreamer.tsx @@ -114,7 +114,12 @@ export default function ProfileEditDreamer() { alert("프로필이 성공적으로 수정되었습니다!"); if (userInfo?.nickName !== data.nickName) { - setLogin(data.nickName, userInfo?.role || "guest", userInfo?.coconut || 0); + setLogin( + data.nickName, + userInfo?.role || "guest", + userInfo?.coconut || 0, + profileInfo.image, + ); } router.reload(); } catch (error: any) { @@ -141,7 +146,7 @@ export default function ProfileEditDreamer() { })(); const ErrorMessage = ({ message }: { message: string | undefined }) => ( -

{message}

+

{message}

); useEffect(() => { @@ -174,9 +179,9 @@ export default function ProfileEditDreamer() { return ( <>

프로필 수정

-
+
-
+
{errors.nickName && } {nickNameMessage &&

{nickNameMessage}

}
-
+
-
+
{errors.phoneNumber && }
-
+
-
+
{errors.newPassword && }
-
+
-

프로필 이미지

+

프로필 이미지

setIsOpenImageModal(true)} className="w-[160px] cursor-pointer"> {profileImg ? ( setIsOpenImageModal(false)} /> )} -
+
-

이용 서비스

-

+

이용 서비스

+

* 플랜 요청 시 이용 서비스를 선택할 수 있어요.

-
+
-

여행 하고 싶은 지역

-

+

여행 하고 싶은 지역

+

* 플랜 요청 시 지역을 설정할 수 있어요.

-
+
From dcb8141393e107c9fb42e3a59edf04c2a644a564 Mon Sep 17 00:00:00 2001 From: Yang ga-hyeon Date: Sun, 23 Feb 2025 15:21:40 +0900 Subject: [PATCH 14/14] =?UTF-8?q?feat:=20=EA=B8=B0=EB=B3=B8=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20=EB=A9=94=EC=8B=9C=EC=A7=80=20=EC=95=8C=EB=A6=BC=20?= =?UTF-8?q?=EB=A9=94=EC=8B=9C=EC=A7=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/services/userService.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/userService.ts b/src/services/userService.ts index ff6aa13..9f4c5c5 100644 --- a/src/services/userService.ts +++ b/src/services/userService.ts @@ -136,7 +136,7 @@ const userService = { await api.patch("/users/update", payload); } catch (error: any) { if (error.response && error.response.status === BAD_REQUEST) { - throw new Error("기존 비밀번호와 일치하지 않습니다."); + throw new Error(error.response.data.message || "알 수 없는 오류가 발생했습니다."); } } },