-
Notifications
You must be signed in to change notification settings - Fork 0
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
19 changed files
with
157 additions
and
63 deletions.
There are no files selected for viewing
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
15 changes: 15 additions & 0 deletions
15
src/pages/sinitto/hello-call-service/api/accept-hello-call.api.ts
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,15 @@ | ||
import { SinittoHelloCallResponse } from './types'; | ||
import { fetchInstance } from '@/shared'; | ||
|
||
const putAcceptHelloCallPath = (callId: number) => | ||
`/api/hellocalls/accept/${callId}`; | ||
|
||
export const putAcceptHelloCall = async ( | ||
callId: number | ||
): Promise<SinittoHelloCallResponse> => { | ||
const response = await fetchInstance.put<SinittoHelloCallResponse>( | ||
putAcceptHelloCallPath(callId) | ||
); | ||
|
||
return response.data; | ||
}; |
6 changes: 3 additions & 3 deletions
6
...-call-report/api/cancel-hello-call.api.ts → ...call-service/api/cancel-hello-call.api.ts
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 |
---|---|---|
@@ -1 +1,3 @@ | ||
export { useGetServiceDetail } from './useGetServiceDetail'; | ||
export { usePutAcceptHelloCall } from './usePutAcceptHelloCall'; | ||
export { usePutCancelHelloCall } from './usePutCancelHelloCall'; |
23 changes: 23 additions & 0 deletions
23
src/pages/sinitto/hello-call-service/api/hooks/usePutAcceptHelloCall.ts
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,23 @@ | ||
import { putAcceptHelloCall } from '../accept-hello-call.api'; | ||
import { SinittoHelloCallResponse } from '../types'; | ||
import { RouterPath } from '@/app/routes'; | ||
import { queryClient } from '@/shared'; | ||
import { useMutation, UseMutationResult } from '@tanstack/react-query'; | ||
|
||
export const usePutAcceptHelloCall = ( | ||
callId: number | ||
): UseMutationResult<SinittoHelloCallResponse, Error, void> => { | ||
return useMutation<SinittoHelloCallResponse, Error, void>({ | ||
mutationFn: () => putAcceptHelloCall(callId), | ||
onSuccess: () => { | ||
queryClient.invalidateQueries({ queryKey: ['helloCallCancel', callId] }); | ||
|
||
alert(`안부전화 서비스가 수락되었습니다.`); | ||
window.location.href = RouterPath.SINITTO; | ||
}, | ||
onError: (error) => { | ||
console.error('안부전화 서비스 수락에 실패했습니다.', error); | ||
alert('안부전화 서비스 수락에 실패했습니다.'); | ||
}, | ||
}); | ||
}; |
9 changes: 4 additions & 5 deletions
9
...report/api/hooks/usePutCancelHelloCall.ts → ...ervice/api/hooks/usePutCancelHelloCall.ts
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export { getServiceDetail } from './service-detail.api'; | ||
export { putAcceptHelloCall } from './accept-hello-call.api'; | ||
|
||
export * from './hooks'; | ||
export * from './types'; |
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 |
---|---|---|
@@ -1 +1,6 @@ | ||
export type { ServiceDetailResponse } from './service-detail.response'; | ||
export type { | ||
TimeSlot, | ||
ServiceDetailResponse, | ||
} from './service-detail.response'; | ||
|
||
export type { SinittoHelloCallResponse } from './sinitto-hello-call.response'; |
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
3 changes: 3 additions & 0 deletions
3
src/pages/sinitto/hello-call-service/api/types/sinitto-hello-call.response.ts
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,3 @@ | ||
export type SinittoHelloCallResponse = { | ||
message: string; | ||
}; |
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,2 @@ | ||
export { useServiceDate } from './useServiceDate'; | ||
export { useFormatPhoneNumber } from './useFormatPhoneNumber'; |
3 changes: 3 additions & 0 deletions
3
src/pages/sinitto/hello-call-service/hooks/useFormatPhoneNumber.ts
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,3 @@ | ||
export const useFormatPhoneNumber = (phoneNumber: string | undefined) => { | ||
return phoneNumber?.replace(/(\d{3})(\d{4})(\d{4})/, '$1 - $2 - $3'); | ||
}; |
Oops, something went wrong.