@@ -6,7 +6,7 @@ import { Input } from '~components/Input'
6
6
import RegisterAvatarModal from '~modals/RegisterAvatarModal'
7
7
import { useModalStore } from '~stores/modalStore'
8
8
import { ActionButton } from '~components/Button/ActionButton'
9
- import PositionChoiceModal from '~modals/PositionChoiceModal'
9
+ import FamilyRoleChoiceModal from '~modals/PositionChoiceModal'
10
10
import { useGeolocation } from '~hooks/useGeolocation'
11
11
import { useOwnerProfileStore } from '~stores/ownerProfileStore'
12
12
import { validateOwnerProfile } from '~utils/validateOwnerProfile'
@@ -18,17 +18,6 @@ import { createRegister } from '~apis/register/createRegister'
18
18
import { FamilyRole } from '~types/common'
19
19
import { useEffect } from 'react'
20
20
21
- const positionLabelMap : Record < FamilyRole , string > = {
22
- MOTHER : '์๋ง' ,
23
- FATHER : '์๋น ' ,
24
- OLDER_BROTHER : 'ํ' ,
25
- ELDER_BROTHER : '์ค๋น ' ,
26
- ELDER_SISTER : '์ธ๋' ,
27
- OLDER_SISTER : '๋๋' ,
28
- GRANDFATHER : 'ํ ์๋ฒ์ง' ,
29
- GRANDMOTHER : 'ํ ๋จธ๋' ,
30
- }
31
-
32
21
export default function Register ( ) {
33
22
const { ownerProfile, setOwnerProfile } = useOwnerProfileStore ( )
34
23
const { location, getCurrentLocation } = useGeolocation ( )
@@ -49,16 +38,16 @@ export default function Register() {
49
38
const registerData = {
50
39
email,
51
40
provider,
52
- name : ownerProfile . nickName ,
41
+ name : ownerProfile . name ,
53
42
gender : ownerProfile . gender as 'MALE' | 'FEMALE' ,
54
- address : ownerProfile . location ,
55
- familyRole : ownerProfile . position as FamilyRole ,
56
- profileImg : ownerProfile . avatar || '' ,
43
+ address : ownerProfile . address ,
44
+ familyRole : ownerProfile . familyRole as FamilyRole ,
45
+ profileImg : ownerProfile . profileImg || '' ,
57
46
}
58
47
59
48
const response = await createRegister ( {
60
49
...registerData ,
61
- provider : registerData . provider as 'KAKAO' | 'NAVER' | ' GOOGLE',
50
+ provider : registerData . provider as 'KAKAO' | 'GOOGLE' ,
62
51
} )
63
52
if ( response . code === 201 ) {
64
53
pushModal ( < RegisterDogPage /> )
@@ -69,7 +58,7 @@ export default function Register() {
69
58
}
70
59
useEffect ( ( ) => {
71
60
if ( location . address ) {
72
- setOwnerProfile ( { location : location . address } )
61
+ setOwnerProfile ( { address : location . address } )
73
62
}
74
63
} , [ location . address , setOwnerProfile ] )
75
64
const handleLocationClick = ( ) => {
@@ -78,15 +67,18 @@ export default function Register() {
78
67
79
68
const handleRoleClick = ( ) => {
80
69
pushModal (
81
- < PositionChoiceModal onSelect = { position => setOwnerProfile ( { position } ) } initialValue = { ownerProfile . position } />
70
+ < FamilyRoleChoiceModal
71
+ onSelectRole = { role => setOwnerProfile ( { familyRole : role } ) }
72
+ initialRole = { ownerProfile . familyRole }
73
+ />
82
74
)
83
75
}
84
76
85
77
const handleAvatarClick = ( ) => {
86
78
pushModal (
87
79
< RegisterAvatarModal
88
- onSelectAvatar = { avatarSrc => setOwnerProfile ( { avatar : avatarSrc } ) }
89
- initialSelectedAvatar = { ownerProfile . avatar }
80
+ onSelectAvatar = { avatarSrc => setOwnerProfile ( { profileImg : avatarSrc } ) }
81
+ initialSelectedAvatar = { ownerProfile . profileImg }
90
82
/>
91
83
)
92
84
}
@@ -105,9 +97,9 @@ export default function Register() {
105
97
< S . TextSection weight = '700' > ๊ฒฌ์ฃผ๋์ ๋ํด{ '\n' } ์๋ ค์ฃผ์ธ์</ S . TextSection >
106
98
107
99
< S . AddOwnerAvatarBtnWrapper >
108
- { ownerProfile . avatar ? (
100
+ { ownerProfile . profileImg ? (
109
101
< S . Avatar onClick = { handleAvatarClick } >
110
- < img src = { ownerProfile . avatar } alt = '์ ํ๋ ์๋ฐํ' />
102
+ < img src = { ownerProfile . profileImg } alt = '์ ํ๋ ์๋ฐํ' />
111
103
</ S . Avatar >
112
104
) : (
113
105
< S . AddOwnerAvatarBtn onClick = { handleAvatarClick } >
@@ -121,15 +113,15 @@ export default function Register() {
121
113
< S . NickNameWrapper >
122
114
< Input
123
115
placeholder = '๋๋ค์ ์
๋ ฅ'
124
- value = { ownerProfile . nickName }
125
- onChange = { e => setOwnerProfile ( { nickName : e . target . value } ) }
116
+ value = { ownerProfile . name }
117
+ onChange = { e => setOwnerProfile ( { name : e . target . value } ) }
126
118
/>
127
119
</ S . NickNameWrapper >
128
- < S . PositionChoiceBtn onClick = { handleRoleClick } $hasSelected = { ! ! ownerProfile . position } >
129
- { ownerProfile . position ? positionLabelMap [ ownerProfile . position as FamilyRole ] : '๊ฐ์กฑ ํฌ์ง์
์ ํ' }
120
+ < S . PositionChoiceBtn onClick = { handleRoleClick } $hasSelected = { ! ! ownerProfile . familyRole } >
121
+ { ownerProfile . familyRole || '๊ฐ์กฑ ํฌ์ง์
์ ํ' }
130
122
</ S . PositionChoiceBtn >
131
- < S . LocationBtn onClick = { handleLocationClick } $hasSelected = { ! ! ownerProfile . location } >
132
- { ownerProfile . location || '๋ด ๋๋ค ๋ถ๋ฌ์ค๊ธฐ' }
123
+ < S . LocationBtn onClick = { handleLocationClick } $hasSelected = { ! ! ownerProfile . address } >
124
+ { ownerProfile . address || '๋ด ๋๋ค ๋ถ๋ฌ์ค๊ธฐ' }
133
125
</ S . LocationBtn >
134
126
< S . GenderSelectBtnWrapper >
135
127
< GenderSelectButton
0 commit comments