-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #326 from Team-Lecue/fix/QA
dev 머지 !!
- Loading branch information
Showing
19 changed files
with
121 additions
and
77 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
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 |
---|---|---|
@@ -1,18 +1,23 @@ | ||
import { useMutation } from 'react-query'; | ||
import { useMutation, useQueryClient } from 'react-query'; | ||
import { useNavigate } from 'react-router-dom'; | ||
|
||
import { deleteMyBook } from '../api/deleteMyBook'; | ||
|
||
const useDeleteMyBook = () => { | ||
const navigate = useNavigate(); | ||
const queryClient = useQueryClient(); | ||
const mutation = useMutation({ | ||
mutationFn: (noteId: number) => { | ||
return deleteMyBook(noteId); | ||
}, | ||
onError: () => navigate('/error'), | ||
onSuccess: () => location.reload(), | ||
onSuccess: () => { | ||
queryClient.refetchQueries(['get-my-lecueBook'], { | ||
exact: true, | ||
}); | ||
}, | ||
}); | ||
return mutation; | ||
return mutation.mutate; | ||
}; | ||
|
||
export default useDeleteMyBook; |
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
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
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,17 +1,23 @@ | ||
import { useMutation } from 'react-query'; | ||
import { useMutation, useQueryClient } from 'react-query'; | ||
import { useNavigate } from 'react-router-dom'; | ||
|
||
import postFavorite from '../api/postFavorite'; | ||
|
||
const usePostFavorite = () => { | ||
const navigate = useNavigate(); | ||
const queryClient = useQueryClient(); | ||
const mutation = useMutation({ | ||
mutationFn: (bookId: number) => { | ||
return postFavorite(bookId); | ||
}, | ||
onError: () => navigate('/error'), | ||
onSuccess: () => { | ||
queryClient.refetchQueries(['get-my-lecueBook'], { | ||
exact: true, | ||
}); | ||
}, | ||
}); | ||
return mutation; | ||
return mutation.mutate; | ||
}; | ||
|
||
export default usePostFavorite; |