-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
352 additions
and
40 deletions.
There are no files selected for viewing
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { useMutation, useQueryClient } from '@tanstack/react-query'; | ||
|
||
import { patch } from '@apis/api'; | ||
import { QUERY_KEY } from '@apis/queryKeys/queryKeys'; | ||
|
||
import { components } from '@schema'; | ||
import { ApiResponseType, ErrorType } from '@types'; | ||
|
||
type GuestUpdateRequest = components['schemas']['GuestUpdateRequest']; | ||
const patchGuestNickname = async ( | ||
guestId: number, | ||
guestNickname: string | ||
): Promise<GuestUpdateRequest | null> => { | ||
try { | ||
const response = await patch<ApiResponseType<GuestUpdateRequest>>(`/v2/guest/${guestId}`, { | ||
guestNickname, | ||
}); | ||
|
||
return response.data.data; | ||
} catch (err) { | ||
console.error('API error:', err); | ||
throw err; | ||
} | ||
}; | ||
|
||
export const usePatchGuestNickname = (guestId: number, setErrorMessage: (msg: string) => void) => { | ||
const queryClient = useQueryClient(); | ||
return useMutation({ | ||
mutationFn: (guestNickname: string) => patchGuestNickname(guestId, guestNickname), | ||
onSuccess: () => { | ||
queryClient.invalidateQueries({ queryKey: [QUERY_KEY.GUEST_INFO] }); | ||
}, | ||
onError: (error: ErrorType) => { | ||
if (error.status === 40008) { | ||
setErrorMessage('* 이미 존재하는 닉네임이에요.'); | ||
} else { | ||
setErrorMessage('닉네임 변경 중 오류가 발생했습니다. 다시 시도해 주세요.'); | ||
} | ||
}, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import type { SVGProps } from 'react'; | ||
const SvgIcEdit20 = (props: SVGProps<SVGSVGElement>) => ( | ||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 21 20" {...props}> | ||
<circle cx={10.5} cy={10} r={10} fill="#5451FF" /> | ||
<path | ||
fill="#fff" | ||
d="m10.18 13.287 3.944-3.944a5.5 5.5 0 0 1-1.773-1.192 5.5 5.5 0 0 1-1.192-1.774L7.214 10.32c-.308.308-.462.462-.594.632q-.234.301-.4.646c-.092.194-.16.4-.298.813l-.727 2.178a.566.566 0 0 0 .716.716l2.178-.727c.413-.137.62-.206.814-.298q.345-.165.645-.4c.17-.132.324-.286.632-.594m5.039-5.039a2.097 2.097 0 1 0-2.966-2.966l-.473.473.02.06a4.7 4.7 0 0 0 1.116 1.77c.513.516 1.14.905 1.83 1.136z" | ||
/> | ||
</svg> | ||
); | ||
export default SvgIcEdit20; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,7 +107,7 @@ const StepTwo = ({ onNext }: StepProps) => { | |
onChange={(e) => handleInputChange(e, 'email')} | ||
placeholder="ex. [email protected]" | ||
isValid={isEmailValid} | ||
errorMessage="유효한 이메일 주소를 \n입력해 주세요." | ||
errorMessage="유효한 이메일 주소를 입력해 주세요." | ||
isCountValue={false} | ||
/> | ||
</section> | ||
|
Oops, something went wrong.