File tree Expand file tree Collapse file tree 5 files changed +47
-5
lines changed Expand file tree Collapse file tree 5 files changed +47
-5
lines changed Original file line number Diff line number Diff line change
1
+ // import { AxiosError } from 'axios'
2
+ // import { APIResponse, ErrorResponse } from '~types/api'
3
+ // import { axiosInstance } from '~apis/axiosInstance'
4
+
5
+ // export type UpdateGangbunttaRequest = {}
6
+
7
+ // export type UpdateGangbunttaResponse = Pick<APIResponse>
8
+
9
+ // export const updateGangbuntta = async (
10
+ // req: UpdateGangbunttaRequest
11
+ // ): Promise<APIResponse<UpdateGangbunttaResponse>> => {
12
+ // try {
13
+ // const { data } = await axiosInstance.patch<APIResponse<UpdateGangbunttaResponse>>(`/member`, req)
14
+ // return data
15
+ // } catch (error) {
16
+ // if (error instanceof AxiosError) {
17
+ // const { response } = error as AxiosError<ErrorResponse>
18
+
19
+ // if (response) {
20
+ // const { code, message } = response.data
21
+ // switch (code) {
22
+ // case 400:
23
+ // throw new Error(message || '잘못된 요청입니다.')
24
+ // case 401:
25
+ // throw new Error(message || '인증에 실패했습니다.')
26
+ // case 500:
27
+ // throw new Error(message || '서버 오류가 발생했습니다.')
28
+ // default:
29
+ // throw new Error(message || '알 수 없는 오류가 발생했습니다.')
30
+ // }
31
+ // }
32
+ // // 요청 자체가 실패한 경우
33
+ // throw new Error('네트워크 연결을 확인해주세요')
34
+ // }
35
+
36
+ // console.error('예상치 못한 에러:', error)
37
+ // throw new Error('다시 시도해주세요')
38
+ // }
39
+ // }
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ export type CreateRegisterResponse = Pick<
15
15
export const createRegister = async ( req : CreateRegisterRequest ) : Promise < APIResponse < CreateRegisterResponse > > => {
16
16
try {
17
17
const response = await axiosInstance . post < APIResponse < CreateRegisterResponse > > ( `/member/join` , req )
18
-
18
+ console . log ( response )
19
19
// 토큰 추출 및 저장
20
20
const accessToken = ( response . headers [ 'authorization' ] as string ) . split ( 'Bearer ' ) [ 1 ]
21
21
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ function HomeContent() {
33
33
34
34
< S . Visual >
35
35
< Typo24 $weight = '700' $textAlign = 'center' >
36
- 오늘은 { data && FAMILY_ROLE [ data . familyRole as keyof typeof FAMILY_ROLE ] } 랑
36
+ 오늘은 { data ?. familyRole ? FAMILY_ROLE [ data . familyRole ] : '' } 랑
37
37
</ Typo24 >
38
38
< Typo24 $weight = '700' $textAlign = 'center' >
39
39
산책가는 날!
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import { useSearchParams } from 'react-router-dom'
17
17
import { createRegister } from '~apis/register/createRegister'
18
18
import { FamilyRole } from '~types/common'
19
19
import { useEffect } from 'react'
20
+ import { FAMILY_ROLE } from '~constants/familyRole'
20
21
21
22
export default function Register ( ) {
22
23
const { ownerProfile, setOwnerProfile } = useOwnerProfileStore ( )
@@ -33,15 +34,17 @@ export default function Register() {
33
34
showToast ( alertMessage )
34
35
return
35
36
}
36
-
37
37
try {
38
+ const familyRoleKey = Object . keys ( FAMILY_ROLE ) . find (
39
+ key => FAMILY_ROLE [ key as keyof typeof FAMILY_ROLE ] === ownerProfile . familyRole
40
+ )
38
41
const registerData = {
39
42
email,
40
43
provider,
41
44
name : ownerProfile . name ,
42
45
gender : ownerProfile . gender as 'MALE' | 'FEMALE' ,
43
46
address : ownerProfile . address ,
44
- familyRole : ownerProfile . familyRole as FamilyRole ,
47
+ familyRole : familyRoleKey as FamilyRole ,
45
48
profileImg : ownerProfile . profileImg || '' ,
46
49
}
47
50
Original file line number Diff line number Diff line change @@ -21,4 +21,4 @@ export const useOwnerProfileStore = create<OwnerProfileStore>(set => ({
21
21
set ( state => ( {
22
22
ownerProfile : { ...state . ownerProfile , ...profile } ,
23
23
} ) ) ,
24
- } ) )
24
+ } ) )
You can’t perform that action at this time.
0 commit comments