>;
}
const EditTime = ({ mentorData, setMentorData }: EditTimeProps) => {
const [isModalOpen, setIsModalOpen] = useState(false);
- const days = ['월', '화', '수', '목', '금', '토', '일'];
+ const availabledays = ['월', '화', '수', '목', '금', '토', '일'];
+ // `HH:MM:SS` 형식에서 시간과 분을 추출하는 함수
+ const parseTime = (time: string) => {
+ const [hour, minute] = time.split(":").map(Number);
+ return { hour, minute };
+ };
+
+ const { hour: startHour, minute: startMinute } = parseTime(mentorData.timezone.startTime);
+ const { hour: endHour, minute: endMinute } = parseTime(mentorData.timezone.endTime);
+
+
+ // 시간 저장
+ const handleSaveTime = () => {
+ setMentorData((prev) => {
+ if (!prev) return prev;
+ return {
+ ...prev,
+ timezone: {
+ ...prev.timezone,
+ startTime: `${String(startHour).padStart(2, '0')}:${String(startMinute).padStart(2, '0')}:00`,
+ endTime: `${String(endHour).padStart(2, '0')}:${String(endMinute).padStart(2, '0')}:00`,
+ },
+ };
+ });
+ };
+
// 요일 선택
const toggleSelection = (day: string) => {
- setMentorData((prev) => ({
- ...prev,
- availableDays: prev.availableDays.includes(day)
- ? prev.availableDays.filter((d) => d !== day)
- : [...prev.availableDays, day],
- }));
+ setMentorData((prev) => {
+ if (!prev) return prev;
+ return {
+ ...prev,
+ timezone: {
+ ...prev.timezone,
+ days: prev.timezone.days.includes(day)
+ ? prev.timezone.days.filter((d) => d !== day)
+ : [...prev.timezone.days, day],
+ }
+ };
+ });
};
return (
@@ -31,11 +63,11 @@ const EditTime = ({ mentorData, setMentorData }: EditTimeProps) => {
{/* 요일 */}
요일
- {days.map((day) => (
+ {availabledays.map((day) => (
{/* 시간대 선택 모달 */}
- setIsModalOpen(false)}
- startPeriod={mentorData.timezone.startTime.period}
- setStartPeriod={(value) =>
- setMentorData((prev) => ({ ...prev, startPeriod: value }))
- }
- startHour={mentorData.timezone.startTime.hour}
+ startHour={startHour}
setStartHour={(value) =>
- setMentorData((prev) => ({ ...prev, startHour: value }))
+ setMentorData((prev) => {
+ if (!prev) return prev;
+ return {
+ ...prev,
+ timezone: {
+ ...prev.timezone,
+ startTime: `${String(value).padStart(2, '0')}:${String(startMinute).padStart(2, '0')}:00`,
+ },
+ } as MentorData;
+ })
}
- startMinute={mentorData.timezone.startTime.minute}
+ startMinute={startMinute}
setStartMinute={(value) =>
- setMentorData((prev) => ({ ...prev, startMinute: value }))
- }
- endPeriod={mentorData.timezone.endTime.period}
- setEndPeriod={(value) =>
- setMentorData((prev) => ({ ...prev, endPeriod: value }))
+ setMentorData((prev) => {
+ if (!prev) return prev;
+ return {
+ ...prev,
+ timezone: {
+ ...prev.timezone,
+ startTime: `${String(startHour).padStart(2, '0')}:${String(value).padStart(2, '0')}:00`,
+ },
+ } as MentorData;
+ })
}
- endHour={mentorData.timezone.endTime.hour}
+ endHour={endHour}
setEndHour={(value) =>
- setMentorData((prev) => ({ ...prev, endHour: value }))
+ setMentorData((prev) => {
+ if (!prev) return prev;
+ return {
+ ...prev,
+ timezone: {
+ ...prev.timezone,
+ endTime: `${String(value).padStart(2, '0')}:${String(endMinute).padStart(2, '0')}:00`,
+ },
+ } as MentorData;
+ })
}
- endMinute={mentorData.timezone.endTime.minute}
+ endMinute={endMinute}
setEndMinute={(value) =>
- setMentorData((prev) => ({ ...prev, endMinute: value }))
+ setMentorData((prev) => {
+ if (!prev) return prev;
+ return {
+ ...prev,
+ timezone: {
+ ...prev.timezone,
+ endTime: `${String(endHour).padStart(2, '0')}:${String(value).padStart(2, '0')}:00`,
+ },
+ } as MentorData;
+ })
}
+ onSave={handleSaveTime}
/>
);
diff --git a/src/user/components/profileInfo/MenteeInfoBio.tsx b/src/user/components/profileInfo/MenteeInfoBio.tsx
index 4c3abfa..c1f0757 100644
--- a/src/user/components/profileInfo/MenteeInfoBio.tsx
+++ b/src/user/components/profileInfo/MenteeInfoBio.tsx
@@ -1,13 +1,11 @@
interface MenteeInfoBioProps {
- summary: string;
- bio: string;
+ introduction: string;
}
-const MenteeInfoBio = ({ summary, bio }: MenteeInfoBioProps) => {
+const MenteeInfoBio = ({ introduction }: MenteeInfoBioProps) => {
return (
-
-
{summary}
-
{bio}
+
);
};
diff --git a/src/user/components/profileInfo/MenteeInfoProfile.tsx b/src/user/components/profileInfo/MenteeInfoProfile.tsx
index 981e496..17da037 100644
--- a/src/user/components/profileInfo/MenteeInfoProfile.tsx
+++ b/src/user/components/profileInfo/MenteeInfoProfile.tsx
@@ -1,12 +1,11 @@
interface MenteeInfoProfileProps {
nickname: string;
- email: string;
schoolName: string;
major: string;
image: string;
}
-const MenteeInfoProfile = ({ nickname, email, schoolName, major, image}: MenteeInfoProfileProps) => {
+const MenteeInfoProfile = ({ nickname, schoolName, major, image}: MenteeInfoProfileProps) => {
return (
@@ -17,7 +16,6 @@ const MenteeInfoProfile = ({ nickname, email, schoolName, major, image}: MenteeI
/>
diff --git a/src/user/components/profileInfo/MentorInfoBio.tsx b/src/user/components/profileInfo/MentorInfoBio.tsx
index 713a9d1..f9c4f78 100644
--- a/src/user/components/profileInfo/MentorInfoBio.tsx
+++ b/src/user/components/profileInfo/MentorInfoBio.tsx
@@ -1,13 +1,13 @@
interface MentorInfoBioProps {
- summary: string;
- bio: string;
+ title: string;
+ content: string;
}
-const MentorInfoBio = ({ summary, bio }: MentorInfoBioProps) => {
+const MentorInfoBio = ({ title, content }: MentorInfoBioProps) => {
return (
-
{summary}
-
{bio}
+
{title}
+
{content}
);
};
diff --git a/src/user/components/profileInfo/MentorInfoPortfolio.tsx b/src/user/components/profileInfo/MentorInfoPortfolio.tsx
index eb2a515..e30c7a3 100644
--- a/src/user/components/profileInfo/MentorInfoPortfolio.tsx
+++ b/src/user/components/profileInfo/MentorInfoPortfolio.tsx
@@ -1,5 +1,5 @@
interface MentorInfoPortfolioProps {
- portfolio: { url: string; description: string; size: number }[];
+ portfolio: { url: string; description: string; size: number } | null;
}
const MentorInfoPortfolio = ({ portfolio }: MentorInfoPortfolioProps) => {
@@ -7,21 +7,21 @@ const MentorInfoPortfolio = ({ portfolio }: MentorInfoPortfolioProps) => {
const openFile = (fileUrl: string) => {
window.open(fileUrl, "_blank");
};
-
+
+ // 포트폴리오가 없으면 렌더링 안 함
+ if (!portfolio) return null;
+
return (
포트폴리오
-
- {portfolio.map((file, index) => (
-
openFile(file.url)}
- >
- {file.description}
- ({file.size.toFixed(1)}MB)
-
- ))}
+
openFile(portfolio.url)}
+ >
+ {portfolio.description}
+
+ ({(portfolio.size / 1000000).toFixed(1)}MB)
+
);
diff --git a/src/user/components/profileInfo/MentorInfoProfile.tsx b/src/user/components/profileInfo/MentorInfoProfile.tsx
index e87bc85..64ecdf1 100644
--- a/src/user/components/profileInfo/MentorInfoProfile.tsx
+++ b/src/user/components/profileInfo/MentorInfoProfile.tsx
@@ -1,13 +1,14 @@
interface MentorInfoProfileProps {
nickname: string;
name: string;
- role: string;
+ jobCategory: string;
+ detailedJob: string;
experience: number;
count: number;
image: string;
}
-const MentorInfoProfile = ({ nickname, name, role, experience, count, image }: MentorInfoProfileProps) => {
+const MentorInfoProfile = ({ nickname, name, jobCategory, detailedJob, experience, count, image }: MentorInfoProfileProps) => {
return (
@@ -18,8 +19,8 @@ const MentorInfoProfile = ({ nickname, name, role, experience, count, image }: M
/>
{nickname}
-
{role}
-
{experience}년차
+
{name}
+
{jobCategory} | {detailedJob} | {experience}년차
diff --git a/src/user/components/profileInfo/MentorInfoTime.tsx b/src/user/components/profileInfo/MentorInfoTime.tsx
index 098ab6b..92d2fb4 100644
--- a/src/user/components/profileInfo/MentorInfoTime.tsx
+++ b/src/user/components/profileInfo/MentorInfoTime.tsx
@@ -1,17 +1,17 @@
interface MentorInfoTimeProps {
- availableDays: string[];
- startTime: { period: string; hour: string; minute: string };
- endTime: { period: string; hour: string; minute: string };
+ days: string[];
+ startTime: string;
+ endTime: string;
}
-const MentorInfoTime = ({ availableDays, startTime, endTime }: MentorInfoTimeProps) => {
+const MentorInfoTime = ({ days, startTime, endTime }: MentorInfoTimeProps) => {
return (
선호 시간대
요일
- {availableDays.map((day, index) => (
+ {days.map((day, index) => (
{day}
@@ -20,7 +20,7 @@ const MentorInfoTime = ({ availableDays, startTime, endTime }: MentorInfoTimePro
시간대
- {`${startTime.period} ${startTime.hour}:${startTime.minute} ~ ${endTime.period} ${endTime.hour}:${endTime.minute}`}
+ {`${startTime} ~ ${endTime}`}
);
diff --git a/src/user/menteetypes.ts b/src/user/menteetypes.ts
index b86522f..fbc82c1 100644
--- a/src/user/menteetypes.ts
+++ b/src/user/menteetypes.ts
@@ -1,16 +1,12 @@
export interface MenteeData {
nickname: string;
- email: string;
education: {
schoolName: string;
major: string;
};
+ introduction: string;
image: {
fileName: string;
filePath: string;
};
- introduction: {
- summary: string;
- bio: string;
- };
}
\ No newline at end of file
diff --git a/src/user/pages/ProfileEdit/MenteeInfo.tsx b/src/user/pages/ProfileEdit/MenteeInfo.tsx
index 5b58432..1c3913c 100644
--- a/src/user/pages/ProfileEdit/MenteeInfo.tsx
+++ b/src/user/pages/ProfileEdit/MenteeInfo.tsx
@@ -1,34 +1,33 @@
-import { useState } from 'react';
+import { useState, useEffect } from 'react';
import { useNavigate } from 'react-router-dom';
import { ArrowLeft } from 'lucide-react';
import { GlobalButton } from '@/global/ui/GlobalButton';
+import { getMenteeProfile } from '@/user/api/MenteeInfoApi';
+import { MenteeData } from '@/user/menteetypes';
+
import MenteeInfoProfile from '@/user/components/profileInfo/MenteeInfoProfile';
import MenteeInfoBio from '@/user/components/profileInfo/MenteeInfoBio';
const MenteeInfo = () => {
const navigate = useNavigate();
+ const [menteeData, setMenteeData] = useState
(null);
- // 테스트용 멘티 데이터 && localStorage에서 데이터 불러오기 (api 연결시 제거)
- const [menteeData, setMenteeData] = useState(() => {
- const savedData = localStorage.getItem("menteeData");
- return savedData ? JSON.parse(savedData) : {
- nickname: "김멘티",
- email: "kimtee@gmail.com",
- education: {
- schoolName: "경북대학교 · 석사",
- major: "심리학과 · 경영학과",
- },
- image: {
- fileName: "",
- filePath: "",
- },
- introduction: {
- summary: "광고 기획자를 꿈꾸는 열정넘치는 학생입니다!",
- bio: "광고 기획자라는 점을 가지고 있는 상황에서 선배님들의 조언을 듣고 싶습니다",
+ useEffect(() => {
+ const fetchData = async () => {
+ try {
+ const data = await getMenteeProfile();
+ setMenteeData(data);
+ } catch (error) {
+ console.error('멘티 정보 로딩 실패:', error);
}
};
- });
+ fetchData();
+ }, []);
+
+ if (!menteeData) {
+ return Loading...
;
+ }
return (
@@ -53,7 +52,6 @@ const MenteeInfo = () => {
{/* 프로필 섹션 */}
{
{/* 자기소개 */}
diff --git a/src/user/pages/ProfileEdit/MenteeProfileEdit.tsx b/src/user/pages/ProfileEdit/MenteeProfileEdit.tsx
index 847e7ac..68531f9 100644
--- a/src/user/pages/ProfileEdit/MenteeProfileEdit.tsx
+++ b/src/user/pages/ProfileEdit/MenteeProfileEdit.tsx
@@ -2,6 +2,8 @@ import { useState, useEffect } from "react";
import { useNavigate } from 'react-router-dom';
import { ArrowLeft } from "lucide-react";
+import { getMenteeProfile, updateMenteeProfile } from "@/user/api/MenteeInfoApi";
+
import { MenteeData } from "@/user/menteetypes";
import EditProfileSectionMentee from "@/user/components/ProfileEdit/EditProfileSectionMentee";
import EditBio from "@/user/components/ProfileEdit/EditBio";
@@ -9,38 +11,49 @@ import { GlobalButton } from "@/global/ui/GlobalButton";
const MenteeProfileEdit = () => {
const navigate = useNavigate();
+ const [menteeData, setMenteeData] = useState({
+ nickname: '',
+ education: {
+ schoolName: '',
+ major: '',
+ },
+ introduction: '',
+ image: {
+ fileName: '',
+ filePath: '',
+ },
+ });
- // 테스트용 멘티 데이터 && localStorage에서 데이터 불러오기 (api 연결시 제거)
- const [menteeData, setMenteeData] = useState(() => {
- const savedData = localStorage.getItem("menteeData");
- return savedData ? JSON.parse(savedData) : {
- nickname: "김멘티",
- email: "kimtee@gmail.com",
- education: {
- schoolName: "경북대학교 · 석사",
- major: "심리학과 · 경영학과",
- },
- image: {
- fileName: "",
- filePath: "",
- },
- introduction: {
- summary: "광고 기획자를 꿈꾸는 열정넘치는 학생입니다!",
- bio: "광고 기획자라는 점을 가지고 있는 상황에서 선배님들의 조언을 듣고 싶습니다",
+ useEffect(() => {
+ const fetchData = async () => {
+ try {
+ const data = await getMenteeProfile();
+ setMenteeData(data);
+ } catch (error) {
+ console.error('멘티 프로필 로딩 실패:', error);
}
};
- });
+ fetchData();
+ }, []);
- // 수정된 내용을 localStorage에 저장하는 함수 (api 연결시 제거)
- const handleSave = () => {
- localStorage.setItem("menteeData", JSON.stringify(menteeData)); // localStorage에 저장
- navigate("/user/menteeinfo"); // 수정 완료 후 MenteeInfo로 이동
+ const handleSave = async () => {
+ try {
+ if (!menteeData) return;
+ await updateMenteeProfile(menteeData);
+ navigate("/user/menteeinfo");
+ } catch (error) {
+ console.error("멘티 프로필 저장 실패:", error);
+ alert("프로필 저장 중 오류가 발생했습니다.");
+ }
};
- // 작성 완료 버튼 활성화 여부 확인
+ if (!menteeData) {
+ return Loading...
;
+ }
+
+ // 작성 완료 버튼 활성화 여부
const isFormComplete =
- menteeData.introduction.summary.trim() !== "" &&
- menteeData.introduction.bio.trim() !== "";
+ menteeData.introduction.trim() !== "";
return (
@@ -70,7 +83,6 @@ const MenteeProfileEdit = () => {
{/* 저장 버튼 */}
isFormComplete && navigate("/user/menteeinfo")}
onClick={handleSave}
disabled={!isFormComplete}
>
diff --git a/src/user/pages/ProfileEdit/MentorInfo.tsx b/src/user/pages/ProfileEdit/MentorInfo.tsx
index 5ab31b3..8fb94e2 100644
--- a/src/user/pages/ProfileEdit/MentorInfo.tsx
+++ b/src/user/pages/ProfileEdit/MentorInfo.tsx
@@ -3,6 +3,11 @@ import { useNavigate } from 'react-router-dom';
import { ArrowLeft } from 'lucide-react';
import { GlobalButton } from '@/global/ui/GlobalButton';
+import { getMentorProfile } from '@/user/api/MentorInfoApi';
+import { MentorData } from '@/user/types';
+import { reverseJobCategoryMapping, reverseDetailedJobMapping } from '@/user/components/Mapping';
+import { reverseMentoringFieldMapping, reverseDayMapping } from '@/user/components/Mapping';
+
import MentorInfoProfile from '@/user/components/profileInfo/MentorInfoProfile';
import MentorInfoBio from '@/user/components/profileInfo/MentorInfoBio';
import MentorInfoFieldsHashtags from '@/user/components/profileInfo/MentorInfoFieldsHashtags';
@@ -12,48 +17,23 @@ import MentorInfoPortfolio from '@/user/components/profileInfo/MentorInfoPortfol
const MentorInfo = () => {
const navigate = useNavigate();
-
- // 테스트용 멘티 데이터 && localStorage에서 데이터 불러오기 (api 연결시 제거)
- const [mentorData, setMentorData] = useState(() => {
- const savedData = localStorage.getItem("mentorData");
- return savedData ? JSON.parse(savedData) : {
- nickname: "바이",
- email: "abcd@gmail.com",
- education: {
- schoolName: "경북대학교",
- major: "컴퓨터공학",
- },
- organization: {
- name: "OO주식회사",
- role: "브랜드 마케팅/카피라이팅",
- experience: 6,
- },
- count: 716,
- image: {
- fileName: "",
- filePath: "",
- },
- introduction: {
- summary: "브랜드 마케팅에 대한 모든 것을 알려드립니다.",
- bio: "안녕하세요!\n저는 OO대학교 경영학과를 졸업하고 현재 XXXX에 다니고 있는 ‘바이’입니다.",
- },
- availableDays: ["월", "목"],
- timezone: {
- startTime: { period: "오전", hour: "10", minute: "00"},
- endTime: { period: "오후", hour: "18", minute: "00"},
- },
- mentoringField: ["취업 준비", "커리어 고민"],
- hashtags: ["마케팅", "브랜드마케팅", "이직", "취준", "진로고민상담", "면접노하우"],
- message: "안녕하세요, 멘티 여러분!\n브랜드 마케팅 경험을 바탕으로 여러분의 성장을 지원하고 싶습니다.",
- portfolio: [
- {
- url: "https://example.com/portfolio1.pdf",
- description: "브랜드 마케팅 포트폴리오.pdf",
- size: 25,
- },
- ],
+ const [mentorData, setMentorData] = useState(null);
+
+ useEffect(() => {
+ const fetchData = async () => {
+ try {
+ const data = await getMentorProfile();
+ setMentorData(data);
+ } catch (error) {
+ console.error('멘토 정보 로딩 실패:', error);
+ }
};
- });
+ fetchData();
+ }, []);
+
+ if (!mentorData) {
+ return Loading...
;
+ }
return (
@@ -69,7 +49,7 @@ const MentorInfo = () => {
size={24}
strokeWidth={1.0}
className="text-white cursor-pointer"
- onClick={() => navigate("/auth")}
+ onClick={() => navigate("/user")}
/>
멘토 프로필
@@ -79,7 +59,8 @@ const MentorInfo = () => {
{
{/* 자기소개 */}
{/* 선호 시간대 */}
reverseDayMapping[day] || day)}
startTime={mentorData.timezone.startTime}
endTime={mentorData.timezone.endTime}
/>
{/* 멘토링 분야 & 해시태그 */}
reverseMentoringFieldMapping[field] || field)}
hashtags={mentorData.hashtags}
/>
diff --git a/src/user/pages/ProfileEdit/MentorProfileEdit.tsx b/src/user/pages/ProfileEdit/MentorProfileEdit.tsx
index 30b81ae..eb0a530 100644
--- a/src/user/pages/ProfileEdit/MentorProfileEdit.tsx
+++ b/src/user/pages/ProfileEdit/MentorProfileEdit.tsx
@@ -4,6 +4,12 @@ import { ArrowLeft } from 'lucide-react';
import { GlobalButton } from '@/global/ui/GlobalButton';
import { MentorData } from '@/user/types';
+import { getMentorProfile, updateMentorProfile } from '@/user/api/MentorInfoApi';
+import { reverseJobCategoryMapping, reverseDetailedJobMapping } from '@/user/components/Mapping';
+import { reverseMentoringFieldMapping, reverseDayMapping } from '@/user/components/Mapping';
+import { jobCategoryMapping, detailedJobMapping } from '@/global/components/JobCategories';
+import { mentoringFieldMapping, dayMapping } from '@/user/components/Mapping';
+
import EditProfileSection from '@/user/components/ProfileEdit/EditProfileSection';
import EditBio from '@/user/components/ProfileEdit/EditBio';
import EditFields from '@/user/components/ProfileEdit/EditFields';
@@ -14,61 +20,71 @@ import EditPortfolio from '@/user/components/ProfileEdit/EditPortfolio';
const MentorProfileEdit = () => {
const navigate = useNavigate();
+ const [mentorData, setMentorData] = useState(null);
+
+ useEffect(() => {
+ const fetchData = async () => {
+ try {
+ const data = await getMentorProfile();
+
+ // 변환
+ const localizedData: MentorData = {
+ ...data,
+ mentoringField: data.mentoringField.map((f) => reverseMentoringFieldMapping[f] || f),
+ timezone: {
+ ...data.timezone,
+ days: data.timezone.days.map((d) => reverseDayMapping[d] || d),
+ },
+ organization: {
+ ...data.organization,
+ jobCategory: reverseJobCategoryMapping[data.organization.jobCategory] || data.organization.jobCategory,
+ detailedJob: reverseDetailedJobMapping[data.organization.detailedJob] || data.organization.detailedJob,
+ }
+ };
- // 테스트용 멘티 데이터 && localStorage에서 데이터 불러오기 (api 연결시 제거)
- const [mentorData, setMentorData] = useState(() => {
- const savedData = localStorage.getItem("mentorData");
- return savedData ? JSON.parse(savedData) : {
- nickname: "바이",
- email: "abcd@gmail.com",
- education: {
- schoolName: "경북대학교",
- major: "컴퓨터공학",
- },
- organization: {
- name: "OO주식회사",
- role: "브랜드 마케팅/카피라이팅",
- experience: 6,
- },
- count: 716,
- image: {
- fileName: "",
- filePath: "",
- },
- introduction: {
- summary: "브랜드 마케팅에 대한 모든 것을 알려드립니다.",
- bio: "안녕하세요!\n저는 OO대학교 경영학과를 졸업하고 현재 XXXX에 다니고 있는 ‘바이’입니다.",
- },
- availableDays: ["월", "목"],
- timezone: {
- startTime: { period: "오전", hour: "10", minute: "00"},
- endTime: { period: "오후", hour: "18", minute: "00"},
- },
- mentoringField: ['취업 준비', '커리어 고민'],
- hashtags: ['마케팅', '브랜드마케팅'],
- message:
- '안녕하세요, 멘티 여러분!\n브랜드 마케팅 경험을 바탕으로 여러분의 성장을 지원하고 싶습니다.',
- portfolio: [
- {
- url: 'https://example.com/portfolio1.pdf',
- description: '브랜드 마케팅 포트폴리오.pdf',
- size: 25000000,
- },
- ],
+ setMentorData(localizedData);
+ } catch (error) {
+ console.error('멘토 정보 로딩 실패:', error);
+ }
};
- });
+ fetchData();
+ }, []);
+
- // 수정된 내용을 localStorage에 저장하는 함수 (API 연결 시 제거)
- const handleSave = () => {
- localStorage.setItem("mentorData", JSON.stringify(mentorData)); // localStorage에 저장
- navigate("/user/mentorinfo"); // 수정 완료 후 MentorInfo로 이동
+ if (!mentorData) {
+ return Loading...
;
+ }
+
+ const handleSave = async () => {
+ try {
+ const payload: MentorData = {
+ ...mentorData,
+ mentoringField: mentorData.mentoringField.map((field) => mentoringFieldMapping[field] || field),
+ timezone: {
+ ...mentorData.timezone,
+ days: mentorData.timezone.days.map((day) => dayMapping[day] || day),
+ },
+ organization: {
+ ...mentorData.organization,
+ jobCategory: jobCategoryMapping[mentorData.organization.jobCategory] || mentorData.organization.jobCategory,
+ detailedJob: detailedJobMapping[mentorData.organization.detailedJob] || mentorData.organization.detailedJob,
+ },
+ };
+
+ await updateMentorProfile(payload);
+ navigate("/user/mentorinfo");
+ } catch (error) {
+ console.error("멘토 정보 저장 실패:", error);
+ alert("멘토 정보 저장 중 오류가 발생했습니다.");
+ }
};
- // 작성 완료 버튼 활성화 여부 확인
+ // 작성 완료 버튼 활성화 여부
const isFormComplete =
- mentorData.introduction.summary.trim() !== '' &&
- mentorData.introduction.bio.trim() !== '' &&
- mentorData.availableDays.length > 0;
+ mentorData.introduction?.title?.trim() !== '' &&
+ mentorData.introduction?.content?.trim() !== '' &&
+ mentorData.timezone?.days?.length > 0;
+
return (
diff --git a/src/user/types.ts b/src/user/types.ts
index 65dc339..5fe4ad5 100644
--- a/src/user/types.ts
+++ b/src/user/types.ts
@@ -1,45 +1,36 @@
export interface MentorData {
nickname: string;
- email: string;
+ introduction: {
+ title: string;
+ content: string;
+ };
+ mentoringField: string[];
education: {
schoolName: string;
major: string;
};
organization: {
name: string;
- role: string;
+ jobCategory: string;
+ detailedJob: string;
experience: number;
};
- count: number;
- image: {
- fileName: string;
- filePath: string;
- };
-
- introduction: {
- summary: string;
- bio: string;
- };
- availableDays: string[];
timezone: {
- startTime: {
- period: string;
- hour: string;
- minute: string;
- };
- endTime: {
- period: string;
- hour: string;
- minute: string;
- };
+ days: string[];
+ startTime: string;
+ endTime: string;
};
-
- mentoringField: string[];
hashtags: string[];
message: string;
portfolio: {
url: string;
description: string;
size: number;
- }[];
+ } | null;
+ image: {
+ fileName: string;
+ filePath: string;
+ };
+
+ count: number;
}