-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 크루 가입 신청 취소하기 기능 추가 * feat: 게스트 모집 참여 취소하기 기능 추가
- Loading branch information
Showing
4 changed files
with
76 additions
and
16 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,24 @@ | ||
import { useMutation } from '@tanstack/react-query'; | ||
import { useQueryClient } from '@tanstack/react-query'; | ||
|
||
import { deleteCrewParticipate } from '@api/crews/deleteCrewParticipate'; | ||
|
||
import { useLoginInfoStore } from '@stores/loginInfo.store'; | ||
|
||
export const useCrewParticipateDeleteMutation = () => { | ||
const queryClient = useQueryClient(); | ||
const id = useLoginInfoStore((state) => state.loginInfo?.id); | ||
|
||
return useMutation({ | ||
mutationFn: deleteCrewParticipate, | ||
onSuccess: (_, { crewId }) => { | ||
queryClient.invalidateQueries({ | ||
queryKey: ['crew-detail', crewId], | ||
}); | ||
id && | ||
queryClient.invalidateQueries({ | ||
queryKey: ['crew-registration', id, crewId], | ||
}); | ||
}, | ||
}); | ||
}; |
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,15 +1,24 @@ | ||
import { useMutation } from '@tanstack/react-query'; | ||
import { useQueryClient } from '@tanstack/react-query'; | ||
|
||
import { deleteGameParticipate } from '@api/games/deleteGameParticipate'; | ||
|
||
import { DeleteGameParticipateRequest } from '@type/api/games'; | ||
import { useLoginInfoStore } from '@stores/loginInfo.store'; | ||
|
||
export const useGameParticipateDeleteMutation = () => { | ||
const queryClient = useQueryClient(); | ||
const id = useLoginInfoStore((state) => state.loginInfo?.id); | ||
|
||
export const useGameParticipateDeleteMutation = ({ | ||
gameId, | ||
memberId, | ||
}: DeleteGameParticipateRequest) => { | ||
return useMutation({ | ||
mutationKey: ['delete-game-participate', gameId, memberId], | ||
mutationFn: () => deleteGameParticipate({ gameId, memberId }), | ||
mutationFn: deleteGameParticipate, | ||
onSuccess: (_, { gameId }) => { | ||
queryClient.invalidateQueries({ | ||
queryKey: ['game-detail', gameId], | ||
}); | ||
id && | ||
queryClient.invalidateQueries({ | ||
queryKey: ['game-registration', id, gameId], | ||
}); | ||
}, | ||
}); | ||
}; |
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