-
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
9 changed files
with
104 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export interface DeleteTimeBlokType { | ||
taskId: number; | ||
timeBlockId: number; | ||
} |
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,10 @@ | ||
import { DeleteTimeBlokType } from './DeleteTimeBlockType'; | ||
|
||
import { privateInstance } from '@/apis/instance'; | ||
|
||
/** TimeBlock 삭제 */ | ||
const deleteTimeBlock = async ({ taskId, timeBlockId }: DeleteTimeBlokType) => { | ||
await privateInstance.delete(`/api/tasks/${taskId}/time-blocks/${timeBlockId}`); | ||
}; | ||
|
||
export default deleteTimeBlock; |
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,17 @@ | ||
import { useMutation, useQueryClient } from '@tanstack/react-query'; | ||
|
||
import deleteTimeBlock from './axios'; | ||
import { DeleteTimeBlokType } from './DeleteTimeBlockType'; | ||
|
||
/** TimeBlock 삭제 */ | ||
const useDeleteTimeBlock = () => { | ||
const queryClient = useQueryClient(); | ||
const mutation = useMutation({ | ||
mutationFn: ({ taskId, timeBlockId }: DeleteTimeBlokType) => deleteTimeBlock({ taskId, timeBlockId }), | ||
onSuccess: () => queryClient.invalidateQueries({ queryKey: ['timeblock'] }), | ||
}); | ||
|
||
return { mutate: mutation.mutate }; | ||
}; | ||
|
||
export default useDeleteTimeBlock; |
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