From 87ce66afe1f0113927c8d69f0c0b6ff5d9681760 Mon Sep 17 00:00:00 2001 From: bigmooon Date: Sun, 31 Aug 2025 21:04:28 +0900 Subject: [PATCH 01/18] fix: add redirect uri --- src/components/Auth/Authform.jsx | 112 ++++++++++++++++--------------- 1 file changed, 58 insertions(+), 54 deletions(-) diff --git a/src/components/Auth/Authform.jsx b/src/components/Auth/Authform.jsx index cd71d82..1b9fd7b 100644 --- a/src/components/Auth/Authform.jsx +++ b/src/components/Auth/Authform.jsx @@ -1,17 +1,17 @@ -import { useState } from 'react'; -import { useNavigate } from 'react-router-dom'; -import { Button } from '@/components/ui/custom/Button'; -import { Input } from '@/components/ui/custom/input'; -import { Alert } from '@/components/ui/custom/alert'; -import { User, LockKeyholeOpen } from 'lucide-react'; -import { navigateToHome } from '@/routes/homeNavigation'; -import Kakao from '/kakao_login_medium_wide.svg'; -import Logo from '/blaybus_logo_icon_text.svg'; -import { CLIENT_ROLE, ROLE_MAP } from '@/constants/authType'; +import { useState } from "react"; +import { useNavigate } from "react-router-dom"; +import { Button } from "@/components/ui/custom/Button"; +import { Input } from "@/components/ui/custom/input"; +import { Alert } from "@/components/ui/custom/alert"; +import { User, LockKeyholeOpen } from "lucide-react"; +import { navigateToHome } from "@/routes/homeNavigation"; +import Kakao from "/kakao_login_medium_wide.svg"; +import Logo from "/blaybus_logo_icon_text.svg"; +import { CLIENT_ROLE, ROLE_MAP } from "@/constants/authType"; const AuthForm = ({ type, onSubmit, setLoginType }) => { const navigate = useNavigate(); - const [alertMessage, setAlertMessage] = useState(''); + const [alertMessage, setAlertMessage] = useState(""); const REST_API_KEY = import.meta.env.VITE_REST_API_KEY; const REDIRECT_URI = import.meta.env.VITE_REDIRECT_URI; @@ -19,21 +19,21 @@ const AuthForm = ({ type, onSubmit, setLoginType }) => { function handleSubmit(e) { e.preventDefault(); - setAlertMessage(''); + setAlertMessage(""); const formData = new FormData(e.target); - const email = formData.get('email')?.trim(); - const password = formData.get('password')?.trim(); + const email = formData.get("email")?.trim(); + const password = formData.get("password")?.trim(); if (!email || !password) { - setAlertMessage('이메일과 비밀번호를 모두 입력해주세요.'); + setAlertMessage("이메일과 비밀번호를 모두 입력해주세요."); return; } onSubmit({ email, password, loginType: type }); } function handleSignUpNavigation() { - navigate(type === 'helper' ? '/helper/signup' : '/center/signup'); + navigate(type === "helper" ? "/helper/signup" : "/center/signup"); } function handleKakaoLogin() { @@ -45,26 +45,26 @@ const AuthForm = ({ type, onSubmit, setLoginType }) => { function handleFindAccount(e) { e.preventDefault(); - navigate('/find-account'); + navigate("/find-account"); } return ( -
+
{/* select login type */} -
+
{/* Alert 메시지 표시 */} - {alertMessage && } + {alertMessage && ( + + )} -
-
- + +
+
-
- +
+
-
+
-
+
From 15aee42c2b3e6d6b52c05d74e0ef880eac16e8fe Mon Sep 17 00:00:00 2001 From: bigmooon Date: Sun, 31 Aug 2025 23:50:39 +0900 Subject: [PATCH 02/18] fix: modify api for kakao --- src/services/kakaoService.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/kakaoService.js b/src/services/kakaoService.js index d49cbb3..0ad1f61 100644 --- a/src/services/kakaoService.js +++ b/src/services/kakaoService.js @@ -5,7 +5,7 @@ export const kakaoApi = { try { const response = await request( 'POST', - '/oauth/kakao-signup', + '/api/oauth/kakao-signup', { code, roleType, From 818b0f06f164d6af2e5cdef9763468911fb284ef Mon Sep 17 00:00:00 2001 From: bigmooon Date: Mon, 1 Sep 2025 00:01:11 +0900 Subject: [PATCH 03/18] fix: change redirect uri --- src/App.jsx | 4 ++-- src/components/Auth/Authform.jsx | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index b96a324..289b741 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -16,7 +16,7 @@ const CenterSignUp = lazy(() => import('./pages/center/SignUp')); const HelperSignUp = lazy(() => import('./pages/helper/SignUp')); const FindAccount = lazy(() => import('./pages/FindAccount')); const SearchCenter = lazy(() => import('./pages/SearchCenter')); -const KakaoCallback = lazy(() => import('./components/Auth/KakaoCallback')); +// const KakaoCallback = lazy(() => import('./components/Auth/KakaoCallback')); const Account = lazy(() => import('./pages/helper/Account/Account')); const AccountEdit = lazy(() => import('./pages/helper/AccountEdit/AccountEdit')); const HelperLocation = lazy(() => import('./pages/helper/AccountEdit/navigate/HelperLocation')); @@ -55,7 +55,7 @@ function App() { } /> - } /> + {/* } /> */} } /> } /> } /> diff --git a/src/components/Auth/Authform.jsx b/src/components/Auth/Authform.jsx index 1b9fd7b..e7912b4 100644 --- a/src/components/Auth/Authform.jsx +++ b/src/components/Auth/Authform.jsx @@ -37,12 +37,12 @@ const AuthForm = ({ type, onSubmit, setLoginType }) => { } function handleKakaoLogin() { - const serverRole = ROLE_MAP.toServer[type]; - const redirectUri = `${KAKAO_AUTH_URL}&state=${serverRole}`; - - window.location.href = redirectUri; + const serverRole = ROLE_MAP.toServer[type]; // MANAGER | MEMBER + const redirectUri = encodeURIComponent( + "https://dolbom-work.co.kr/login/oauth2/code/kakao" + ); + window.location.href = `${KAKAO_AUTH_URL}&redirect_uri=${redirectUri}&state=${serverRole}`; } - function handleFindAccount(e) { e.preventDefault(); navigate("/find-account"); From 8abe3f31c705566eab0e773e847149540213dcb9 Mon Sep 17 00:00:00 2001 From: bigmooon Date: Mon, 1 Sep 2025 00:22:16 +0900 Subject: [PATCH 04/18] revert: revert kakaoCallback --- src/App.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index 289b741..b96a324 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -16,7 +16,7 @@ const CenterSignUp = lazy(() => import('./pages/center/SignUp')); const HelperSignUp = lazy(() => import('./pages/helper/SignUp')); const FindAccount = lazy(() => import('./pages/FindAccount')); const SearchCenter = lazy(() => import('./pages/SearchCenter')); -// const KakaoCallback = lazy(() => import('./components/Auth/KakaoCallback')); +const KakaoCallback = lazy(() => import('./components/Auth/KakaoCallback')); const Account = lazy(() => import('./pages/helper/Account/Account')); const AccountEdit = lazy(() => import('./pages/helper/AccountEdit/AccountEdit')); const HelperLocation = lazy(() => import('./pages/helper/AccountEdit/navigate/HelperLocation')); @@ -55,7 +55,7 @@ function App() { } /> - {/* } /> */} + } /> } /> } /> } /> From 80fe0fe19eaed4cbca0f18f699b30cf45f189590 Mon Sep 17 00:00:00 2001 From: bigmooon Date: Mon, 1 Sep 2025 00:45:02 +0900 Subject: [PATCH 05/18] feat: add debugging log --- src/api/index.js | 3 ++- src/components/Auth/KakaoCallback.jsx | 23 ++++++++++++++++++++++- src/services/kakaoService.js | 27 +++++++++++++++------------ 3 files changed, 39 insertions(+), 14 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index 8fac24a..80530db 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -3,7 +3,8 @@ import { handleApiError } from '@/utils/handleApiError'; import useAuthStore from '@/store/useAuthStore'; const API_BASE_URL = - import.meta.env.VITE_API_BASE_URL || (import.meta.env.PROD ? '' : 'http://localhost:5173'); + import.meta.env.VITE_API_BASE_URL || + (import.meta.env.PROD ? 'https://dolbom-work.co.kr:8080' : ''); const api = axios.create({ baseURL: API_BASE_URL, diff --git a/src/components/Auth/KakaoCallback.jsx b/src/components/Auth/KakaoCallback.jsx index 7881878..4054477 100644 --- a/src/components/Auth/KakaoCallback.jsx +++ b/src/components/Auth/KakaoCallback.jsx @@ -42,15 +42,29 @@ const KakaoCallback = () => { const handleKakaoLogin = async () => { try { + console.log('[KAKAO CALLBACK] 카카오 로그인 처리 시작:', { code, roleType }); setLoadingMessage('서버와 통신 중입니다...'); // login api 호출 const response = await kakaoApi.login(code, roleType); + console.log('[KAKAO CALLBACK] 서버 응답:', response); + const { caseType, email, nickName, roleType: resRole } = response || {}; // 필수 응답 검증 - if (!caseType || !email) throw new Error('서버 응답이 올바르지 않습니다.'); + if (!caseType || !email) { + console.error('[KAKAO CALLBACK] 서버 응답 검증 실패:', response); + throw new Error('서버 응답이 올바르지 않습니다.'); + } + console.log( + '[KAKAO CALLBACK] 케이스 타입:', + caseType, + '이메일:', + email, + '응답 역할:', + resRole, + ); setLoadingMessage('로그인 정보를 처리하고 있습니다...'); const message = ALERT_MESSAGES[caseType] || ALERT_MESSAGES.DEFAULT; @@ -89,6 +103,12 @@ const KakaoCallback = () => { throw new Error('알 수 없는 인증 케이스입니다.'); } } catch (e) { + console.error('[KAKAO CALLBACK] 에러 발생:', { + message: e.message, + status: e.response?.status, + data: e.response?.data, + stack: e.stack, + }); setError(e.message); setIsLoading(false); redirectToHome(); @@ -120,6 +140,7 @@ const KakaoCallback = () => { } handleKakaoLogin(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); if (isLoading) { diff --git a/src/services/kakaoService.js b/src/services/kakaoService.js index 0ad1f61..ba15141 100644 --- a/src/services/kakaoService.js +++ b/src/services/kakaoService.js @@ -3,20 +3,23 @@ import { request } from '@/api'; export const kakaoApi = { login: async (code, roleType) => { try { - const response = await request( - 'POST', - '/api/oauth/kakao-signup', - { - code, - roleType, - }, - { - timeout: 15000, - }, - ); + console.log('[KAKAO API] 요청 시작:', { code, roleType }); + + const response = await request('POST', '/api/oauth/kakao-signup', { + code, + roleType, + }); + + console.log('[KAKAO API] 응답 성공:', response); return response; } catch (error) { - console.error('[KAKAO API] 로그인 요청 실패:', error); + console.error('[KAKAO API] 로그인 요청 실패:', { + message: error.message, + status: error.response?.status, + data: error.response?.data, + url: error.config?.url, + method: error.config?.method, + }); throw error; } }, From e459cb98a09865fadbbcc95fc08eea78a2435efd Mon Sep 17 00:00:00 2001 From: bigmooon Date: Mon, 1 Sep 2025 00:49:51 +0900 Subject: [PATCH 06/18] feat: add debug console for router --- src/App.jsx | 13 ++++++++++++- src/components/Auth/KakaoCallback.jsx | 3 +++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/App.jsx b/src/App.jsx index b96a324..71dc335 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -40,6 +40,9 @@ const ChatRoomsPage = lazy(() => import('./pages/center/ChatRoomsPage')); const PrivateChatRoom = lazy(() => import('./pages/center/PrivateChatRoom')); function App() { + console.log('[APP] 현재 URL:', window.location.href); + console.log('[APP] pathname:', window.location.pathname); + return ( @@ -55,7 +58,15 @@ function App() { } /> - } /> + + {console.log('[ROUTER] 카카오 콜백 라우트 매칭됨')} + +
+ } + /> } /> } /> } /> diff --git a/src/components/Auth/KakaoCallback.jsx b/src/components/Auth/KakaoCallback.jsx index 4054477..fae9e92 100644 --- a/src/components/Auth/KakaoCallback.jsx +++ b/src/components/Auth/KakaoCallback.jsx @@ -15,8 +15,11 @@ const ALERT_MESSAGES = { }; const KakaoCallback = () => { + console.log('[KAKAO CALLBACK] 컴포넌트 시작됨'); const navigate = useNavigate(); const [searchParams] = useSearchParams(); + console.log('[KAKAO CALLBACK] 현재 URL:', window.location.href); + console.log('[KAKAO CALLBACK] 검색 파라미터:', searchParams.toString()); // URL 파라미터 추출 const code = searchParams.get('code'); From e400503ba2e081da20cf26bfa1a66432bde298d8 Mon Sep 17 00:00:00 2001 From: bigmooon Date: Mon, 1 Sep 2025 00:58:31 +0900 Subject: [PATCH 07/18] feat: add oauth location --- nginx.conf | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nginx.conf b/nginx.conf index 6adeca2..2ca53b5 100644 --- a/nginx.conf +++ b/nginx.conf @@ -17,6 +17,14 @@ http { listen 80; # 외부에서 80포트로 들어오는 요청 수신 root /usr/share/nginx/html; index index.html; + + location ^~ /login/oauth2/ { + proxy_pass http://backend-container; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; # HTTPS 환경 리다이렉트/쿠키 이슈 방지 + } # 1. 정적 파일 요청 처리 location / { From 87492117ec01c1e5223ee1cc454c60375b1ad899 Mon Sep 17 00:00:00 2001 From: paper <109445934+bigmooon@users.noreply.github.com> Date: Mon, 1 Sep 2025 01:18:00 +0900 Subject: [PATCH 08/18] Revert "feat: add oauth location" --- nginx.conf | 8 -------- 1 file changed, 8 deletions(-) diff --git a/nginx.conf b/nginx.conf index 2ca53b5..6adeca2 100644 --- a/nginx.conf +++ b/nginx.conf @@ -17,14 +17,6 @@ http { listen 80; # 외부에서 80포트로 들어오는 요청 수신 root /usr/share/nginx/html; index index.html; - - location ^~ /login/oauth2/ { - proxy_pass http://backend-container; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; # HTTPS 환경 리다이렉트/쿠키 이슈 방지 - } # 1. 정적 파일 요청 처리 location / { From 96a01513914224f7b05a51d52037beeb313cea4a Mon Sep 17 00:00:00 2001 From: bigmooon Date: Mon, 1 Sep 2025 01:25:51 +0900 Subject: [PATCH 09/18] chore: fix base router --- vite.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vite.config.js b/vite.config.js index 487cec9..6edabaa 100644 --- a/vite.config.js +++ b/vite.config.js @@ -5,7 +5,7 @@ import path from 'path'; // https://vite.dev/config/ export default defineConfig({ - base: './', + base: '/', plugins: [react(), tailwindcss()], resolve: { alias: { From 2d592c636d59382a924609e1a034ee90ad13df2d Mon Sep 17 00:00:00 2001 From: bigmooon Date: Mon, 1 Sep 2025 01:32:41 +0900 Subject: [PATCH 10/18] chore; delete api in kakaoService --- src/services/kakaoService.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/kakaoService.js b/src/services/kakaoService.js index ba15141..709b649 100644 --- a/src/services/kakaoService.js +++ b/src/services/kakaoService.js @@ -5,7 +5,7 @@ export const kakaoApi = { try { console.log('[KAKAO API] 요청 시작:', { code, roleType }); - const response = await request('POST', '/api/oauth/kakao-signup', { + const response = await request('POST', '/oauth/kakao-signup', { code, roleType, }); From cb4507d99bb68a99961b8ef4eacad1539e7b48d1 Mon Sep 17 00:00:00 2001 From: TakioN Date: Tue, 2 Sep 2025 04:56:13 +0900 Subject: [PATCH 11/18] Feat: connect api to care-giver profile update --- src/pages/helper/Account/Account.jsx | 43 ++-- src/pages/helper/AccountEdit/AccountEdit.jsx | 32 ++- src/pages/helper/AccountEdit/BaseSection.jsx | 12 +- .../helper/AccountEdit/CareTypeSection .jsx | 34 ++- .../helper/AccountEdit/CareerSection.jsx | 12 +- .../helper/AccountEdit/CertificateSection.jsx | 31 +-- src/pages/helper/AccountEdit/IntroSection.jsx | 9 +- .../helper/AccountEdit/LocationSection.jsx | 6 +- .../AccountEdit/navigate/AccountCareType.jsx | 195 +++++++++++------- .../AccountEdit/navigate/AccountSchedule.jsx | 19 +- src/store/helper/useHelperAccoutStore.js | 149 ++++++------- src/store/suho/useHelperLocationStore.js | 149 ++++++------- src/store/suho/useScheduleStore.js | 5 +- 13 files changed, 384 insertions(+), 312 deletions(-) diff --git a/src/pages/helper/Account/Account.jsx b/src/pages/helper/Account/Account.jsx index ea2a50f..3dd09b2 100644 --- a/src/pages/helper/Account/Account.jsx +++ b/src/pages/helper/Account/Account.jsx @@ -7,6 +7,7 @@ import useScheduleStore from '@/store/suho/useScheduleStore'; import { useHeaderPropsStore } from '@/store/useHeaderPropsStore'; import useAuthStore from '@/store/useAuthStore'; import useHelperAccountStore from '@/store/helper/useHelperAccoutStore'; +import useHelperLocationStore from '@/store/suho/useHelperLocationStore'; // import { useAddressStore } from '@/store/useAddressStore'; // ✅ 3. UI 컴포넌트 (공통 UI → 커스텀 컴포넌트 순) @@ -20,27 +21,23 @@ import backarrow from '@/assets/images/back-arrow.png'; import homecontrols from '@/assets/images/home-controls.png'; import { DAYS } from '@/constants/days'; -//temp -import useProfileStore from '@/store/useProfileStore'; - export default function Account() { - const { optimizedSchedule } = useScheduleStore(); + const { updateSchedule } = useScheduleStore(); const PAY_TYPES = ['시급', '일급', '주급']; const { user } = useAuthStore(); - const { helper, setHelper } = useHelperAccountStore(); + const { helper, setHelper, workTypeNames, setWorkTypeNames } = useHelperAccountStore(); + const { addDistrict } = useHelperLocationStore(); // const { getAddressNameById } = useAddressStore(); const navigate = useNavigate(); - const { profileEdit } = useProfileStore(); const setHeaderProps = useHeaderPropsStore((state) => state.setHeaderProps); const clearHeaderProps = useHeaderPropsStore((state) => state.clearHeaderProps); const [afss, setAfss] = useState([]); const [asss, setAsss] = useState([]); const [atss, setAtss] = useState([]); - const [workTypes, setWorkTypes] = useState([]); useEffect(() => { setHeaderProps({ @@ -87,12 +84,19 @@ export default function Account() { const fetchedatss = await request('get', `/third/${location.asSeq}`); let third = fetchedatss.find((item) => item.id === location.atSeq); setAtss((prev) => [...prev, third.name]); + + addDistrict(first.name, second.name, third.name); + + for (let sch of helperInfo.helperWorkTime) { + updateSchedule(DAYS[sch.date - 1][0], 'start', sch.startTime); + updateSchedule(DAYS[sch.date - 1][0], 'end', sch.endTime); + } } const wtype = await request('post', '/cmn/part-request-care-list', { careTopEnumList: ['WORK_TYPE'], }); - setWorkTypes(wtype.workTypeList); + setWorkTypeNames(getWorkType(wtype.workTypeList, helperInfo.workType).split(', ')); } catch (e) { console.error('나의 정보를 가져오는데 실패했습니다 : ' + e); } @@ -126,22 +130,20 @@ export default function Account() { )); }; - const getWorkType = () => { - if (workTypes.length === 0) return; - const workTypeBit = helper.workType; + const getWorkType = (wtps, wtb) => { + if (!wtps) return; const res = []; for (let i = 0; i < 7; i++) { const mask = 1 << i; - if (workTypeBit & mask) { + if (wtb & mask) { res.push(mask); } } - return workTypes - .filter((x) => res.includes(x.careVal)) - .map((y) => y.careName) - .join(', '); + const data = wtps.filter((x) => res.includes(x.careVal)).map((y) => y.careName); + + return data.join(', '); }; return ( @@ -181,7 +183,7 @@ export default function Account() { > @@ -244,12 +246,7 @@ export default function Account() {
homeControls_icon - - {getWorkType()} - {/* {profileEdit.careTypes.workTypes.length > 0 - ? profileEdit.careTypes.workTypes.map((item) => item.label).join(', ') - : '설정되지 않음'} */} - + {workTypeNames.join(', ')}
diff --git a/src/pages/helper/AccountEdit/AccountEdit.jsx b/src/pages/helper/AccountEdit/AccountEdit.jsx index 1e590d3..1033023 100644 --- a/src/pages/helper/AccountEdit/AccountEdit.jsx +++ b/src/pages/helper/AccountEdit/AccountEdit.jsx @@ -8,6 +8,7 @@ import useHelperLocationStore from '@/store/suho/useHelperLocationStore'; import useScheduleStore from '@/store/suho/useScheduleStore'; import usePayStore from '@/store/suho/usePayStore'; import { useHeaderPropsStore } from '@/store/useHeaderPropsStore'; +import useHelperAccountStore from '@/store/helper/useHelperAccoutStore'; // ✅ 3. UI 컴포넌트 (공통 UI → 커스텀 컴포넌트 순) import { Button } from '@/components/ui/custom/Button'; @@ -21,6 +22,7 @@ import BaseSection from '@/pages/helper/AccountEdit/BaseSection'; import CertificateSection from '@/pages/helper/AccountEdit/CertificateSection'; import PaySection from '@/pages/helper/AccountEdit/PaySection'; import ScheduleSection from './ScheduleSection'; +import { request } from '@/api'; export default function AccountEdit() { const navigate = useNavigate(); @@ -31,6 +33,7 @@ export default function AccountEdit() { const { pay } = usePayStore(); const setHeaderProps = useHeaderPropsStore((state) => state.setHeaderProps); const clearHeaderProps = useHeaderPropsStore((state) => state.clearHeaderProps); + const { helper } = useHelperAccountStore(); useEffect(() => { setHeaderProps({ type: 'back', title: '나의 계정' }); @@ -57,8 +60,33 @@ export default function AccountEdit() { // schedules: schedules, }; - // 한 번에 저장 - updateProfile(newProfile); + await request('put', '/helper/complete-profile', { + introduce: helper.introduce, + careExperience: helper.careExperience, + certificates: helper.certificates, + wage: helper.wage, + wageState: helper.wageState, + wageNegotiation: helper.wageNegotiation, + addressFirstIds: helper.helperWorkLocation.map((x) => x.afSeq), + addressSecondIds: helper.helperWorkLocation.map((x) => x.asSeq), + addressThirdIds: helper.helperWorkLocation.map((x) => x.atSeq), + workTimes: helper.helperWorkTime.map(({ date, startTime, endTime }) => ({ + day: date, + startTime, + endTime, + })), + negotiation: helper.helperWorkTime[0].negotiation, + workTerm: +helper.helperWorkTime[0].workTerm[0], + careLevel: helper.careLevel, + inmateState: helper.inmateState, + workType: helper.workType, + careGender: helper.careGender, + serviceMeal: helper.serviceMeal, + serviceMobility: helper.serviceMobility, + serviceDaily: helper.serviceDaily, + verifyQnet: true, + }); + navigate('/helper/account'); } catch (error) { console.error('프로필 저장 실패:', error); diff --git a/src/pages/helper/AccountEdit/BaseSection.jsx b/src/pages/helper/AccountEdit/BaseSection.jsx index 5948cb4..9fff0b7 100644 --- a/src/pages/helper/AccountEdit/BaseSection.jsx +++ b/src/pages/helper/AccountEdit/BaseSection.jsx @@ -1,14 +1,12 @@ -import useProfileStore from '@/store/useProfileStore'; import useHelperAccountStore from '@/store/helper/useHelperAccoutStore'; function BaseSection() { - const { profileEdit, updateProfileField } = useProfileStore(); - const { helper } = useHelperAccountStore(); + const { helper, setPart } = useHelperAccountStore(); return (
profile_image @@ -21,7 +19,7 @@ function BaseSection() { const file = e.target.files?.[0]; if (file) { const imageUrl = URL.createObjectURL(file); - updateProfileField('profileImage', imageUrl); + setPart({ img: imageUrl }); } }} /> @@ -41,10 +39,10 @@ function BaseSection() {
- {helper.name || '홍길동'} + {helper.name} - {helper.addressDetail || '서울특별시 광진구'} 거주 + {helper.addressDetail} 거주
diff --git a/src/pages/helper/AccountEdit/CareTypeSection .jsx b/src/pages/helper/AccountEdit/CareTypeSection .jsx index dc4caec..9b8531a 100644 --- a/src/pages/helper/AccountEdit/CareTypeSection .jsx +++ b/src/pages/helper/AccountEdit/CareTypeSection .jsx @@ -1,34 +1,28 @@ -import { useNavigate } from "react-router-dom"; -import homecontrols from "@/assets/images/home-controls.png"; -import useProfileStore from "@/store/useProfileStore"; +import { useNavigate } from 'react-router-dom'; +import homecontrols from '@/assets/images/home-controls.png'; +import useProfileStore from '@/store/useProfileStore'; +import useHelperAccountStore from '@/store/helper/useHelperAccoutStore'; const CareTypeSection = () => { const navigate = useNavigate(); const { profileEdit } = useProfileStore(); // Zustand store에서 데이터 가져오기 + const { workTypeNames } = useHelperAccountStore(); const careTypeData = profileEdit.careTypes; return (
navigate("/helper/account/care-type")} + className=' helper-section hover:cursor-pointer' + onClick={() => navigate('/helper/account/care-type')} > -
- 나의 희망 돌봄유형 - - 내가 자신있는 돌봄 유형을 설정해 보세요! - +
+ 나의 희망 돌봄유형 + 내가 자신있는 돌봄 유형을 설정해 보세요!
-
- homeControls_icon - - {careTypeData.workTypes.length > 0 - ? careTypeData.workTypes.map((item) => item.label).join(", ") - : "설정되지 않음"} +
+ homeControls_icon + + {workTypeNames.length > 0 ? workTypeNames.join(', ') : '설정되지 않음'}
diff --git a/src/pages/helper/AccountEdit/CareerSection.jsx b/src/pages/helper/AccountEdit/CareerSection.jsx index f365823..aff0e11 100644 --- a/src/pages/helper/AccountEdit/CareerSection.jsx +++ b/src/pages/helper/AccountEdit/CareerSection.jsx @@ -1,8 +1,8 @@ import { Radio, RadioItem } from '@/components/ui/custom/multiRadio'; -import useProfileStore from '@/store/useProfileStore'; +import useHelperAccountStore from '@/store/helper/useHelperAccoutStore'; const CareExperienceSelector = () => { - const { profileEdit, updateProfileField } = useProfileStore(); + const { helper, setPart } = useHelperAccountStore(); return (
@@ -12,15 +12,15 @@ const CareExperienceSelector = () => {

updateProfileField('careExperience', value)} + onValueChange={(value) => setPart({ careExperience: value })} cols={2} className='flex items-center gap-8' - value={profileEdit.careExperience} // Zustand에서 직접 가져옴 + value={helper.careExperience} // Zustand에서 직접 가져옴 > - + 신입 - + 경력 diff --git a/src/pages/helper/AccountEdit/CertificateSection.jsx b/src/pages/helper/AccountEdit/CertificateSection.jsx index 49f1a7a..c3e3cfd 100644 --- a/src/pages/helper/AccountEdit/CertificateSection.jsx +++ b/src/pages/helper/AccountEdit/CertificateSection.jsx @@ -5,20 +5,19 @@ import useHelperAccountStore from '@/store/helper/useHelperAccoutStore'; const CertificationSection = () => { const { profileEdit, updateProfileField } = useProfileStore(); - const { helper } = useHelperAccountStore(); + const { helper, addCertificate, deleteCertificate } = useHelperAccountStore(); const certificates = ['요양보호사', '간병사', '병원동행매니저', '산후관리사']; const handleRadioChange = (certificate, isChecked) => { - updateProfileField('selectedOptions', { - ...profileEdit.selectedOptions, - [certificate]: isChecked, - }); - // 체크가 해제되면 해당 자격증 정보 입력 필드도 초기화 (선택 사항) - if (!isChecked && profileEdit.inputs[certificate]) { - updateProfileField('inputs', { - ...profileEdit.inputs, - [certificate]: '', + if (isChecked) { + addCertificate({ + certName: certificate, + certNum: '', + certDateIssue: null, + certSerialNum: null, }); + } else { + deleteCertificate(certificate); } }; @@ -38,7 +37,15 @@ const CertificationSection = () => { {certificates.map((certificate) => { - const isChecked = helper.certificates.includes(certificate); + let certNum = ''; + const isChecked = helper.certificates.some( + (item) => item.certName.split(' ')[0] === certificate, + ); + if (isChecked) { + certNum = helper.certificates.find( + (x) => x.certName.split(' ')[0] === certificate, + ).certNum; + } return (
{ { const INTRODUCTIONMAX = 75; // 소개 최대 글자 수 - const { profileEdit, updateProfileField } = useProfileStore(); + const { helper, setPart } = useHelperAccountStore(); const textareaRef = useRef(null); const handleInput = (e) => { - updateProfileField('introduction', e.target.value); + // updateProfileField('introduction', e.target.value); + setPart({ introduce: e.target.value }); const el = textareaRef.current; if (el) { @@ -25,7 +26,7 @@ const IntroductionInput = () => {