@@ -7,6 +7,7 @@ import useScheduleStore from '@/store/suho/useScheduleStore';
77import { useHeaderPropsStore } from '@/store/useHeaderPropsStore' ;
88import useAuthStore from '@/store/useAuthStore' ;
99import useHelperAccountStore from '@/store/helper/useHelperAccoutStore' ;
10+ import useHelperLocationStore from '@/store/suho/useHelperLocationStore' ;
1011// import { useAddressStore } from '@/store/useAddressStore';
1112
1213// ✅ 3. UI 컴포넌트 (공통 UI → 커스텀 컴포넌트 순)
@@ -20,27 +21,23 @@ import backarrow from '@/assets/images/back-arrow.png';
2021import homecontrols from '@/assets/images/home-controls.png' ;
2122import { DAYS } from '@/constants/days' ;
2223
23- //temp
24- import useProfileStore from '@/store/useProfileStore' ;
25-
2624export default function Account ( ) {
27- const { optimizedSchedule } = useScheduleStore ( ) ;
25+ const { updateSchedule } = useScheduleStore ( ) ;
2826 const PAY_TYPES = [ '시급' , '일급' , '주급' ] ;
2927
3028 const { user } = useAuthStore ( ) ;
31- const { helper, setHelper } = useHelperAccountStore ( ) ;
29+ const { helper, setHelper, workTypeNames, setWorkTypeNames } = useHelperAccountStore ( ) ;
30+ const { addDistrict } = useHelperLocationStore ( ) ;
3231 // const { getAddressNameById } = useAddressStore();
3332
3433 const navigate = useNavigate ( ) ;
3534
36- const { profileEdit } = useProfileStore ( ) ;
3735 const setHeaderProps = useHeaderPropsStore ( ( state ) => state . setHeaderProps ) ;
3836 const clearHeaderProps = useHeaderPropsStore ( ( state ) => state . clearHeaderProps ) ;
3937
4038 const [ afss , setAfss ] = useState ( [ ] ) ;
4139 const [ asss , setAsss ] = useState ( [ ] ) ;
4240 const [ atss , setAtss ] = useState ( [ ] ) ;
43- const [ workTypes , setWorkTypes ] = useState ( [ ] ) ;
4441
4542 useEffect ( ( ) => {
4643 setHeaderProps ( {
@@ -87,12 +84,19 @@ export default function Account() {
8784 const fetchedatss = await request ( 'get' , `/third/${ location . asSeq } ` ) ;
8885 let third = fetchedatss . find ( ( item ) => item . id === location . atSeq ) ;
8986 setAtss ( ( prev ) => [ ...prev , third . name ] ) ;
87+
88+ addDistrict ( first . name , second . name , third . name ) ;
89+
90+ for ( let sch of helperInfo . helperWorkTime ) {
91+ updateSchedule ( DAYS [ sch . date - 1 ] [ 0 ] , 'start' , sch . startTime ) ;
92+ updateSchedule ( DAYS [ sch . date - 1 ] [ 0 ] , 'end' , sch . endTime ) ;
93+ }
9094 }
9195
9296 const wtype = await request ( 'post' , '/cmn/part-request-care-list' , {
9397 careTopEnumList : [ 'WORK_TYPE' ] ,
9498 } ) ;
95- setWorkTypes ( wtype . workTypeList ) ;
99+ setWorkTypeNames ( getWorkType ( wtype . workTypeList , helperInfo . workType ) . split ( ', ' ) ) ;
96100 } catch ( e ) {
97101 console . error ( '나의 정보를 가져오는데 실패했습니다 : ' + e ) ;
98102 }
@@ -126,22 +130,20 @@ export default function Account() {
126130 ) ) ;
127131 } ;
128132
129- const getWorkType = ( ) => {
130- if ( workTypes . length === 0 ) return ;
131- const workTypeBit = helper . workType ;
133+ const getWorkType = ( wtps , wtb ) => {
134+ if ( ! wtps ) return ;
132135 const res = [ ] ;
133136
134137 for ( let i = 0 ; i < 7 ; i ++ ) {
135138 const mask = 1 << i ;
136- if ( workTypeBit & mask ) {
139+ if ( wtb & mask ) {
137140 res . push ( mask ) ;
138141 }
139142 }
140143
141- return workTypes
142- . filter ( ( x ) => res . includes ( x . careVal ) )
143- . map ( ( y ) => y . careName )
144- . join ( ', ' ) ;
144+ const data = wtps . filter ( ( x ) => res . includes ( x . careVal ) ) . map ( ( y ) => y . careName ) ;
145+
146+ return data . join ( ', ' ) ;
145147 } ;
146148
147149 return (
@@ -181,7 +183,7 @@ export default function Account() {
181183 >
182184 < span
183185 className = { `
184- ${ profileEdit . introduction ? 'text-[#191919]' : 'text-[#C8C8C8]' }
186+ ${ helper . introduce ? 'text-[#191919]' : 'text-[#C8C8C8]' }
185187 profile-section__content-text
186188 ` }
187189 >
@@ -244,12 +246,7 @@ export default function Account() {
244246
245247 < div className = 'profile-section__content-box' >
246248 < img className = 'w-[24px] h-[24px]' src = { homecontrols } alt = 'homeControls_icon' />
247- < span className = 'profile-section__content-text' >
248- { getWorkType ( ) }
249- { /* {profileEdit.careTypes.workTypes.length > 0
250- ? profileEdit.careTypes.workTypes.map((item) => item.label).join(', ')
251- : '설정되지 않음'} */ }
252- </ span >
249+ < span className = 'profile-section__content-text' > { workTypeNames . join ( ', ' ) } </ span >
253250 </ div >
254251 </ section >
255252
0 commit comments