-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FE] 일반로그인시에 리액트쿼리로 invalidate하고 에러메시지 정상표시안되던 현상을 해결한다. (#916)
- Loading branch information
Showing
6 changed files
with
48 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { useMutation, useQueryClient } from '@tanstack/react-query'; | ||
import { useNavigate } from 'react-router-dom'; | ||
|
||
import { postSignIn } from '@/apis/user'; | ||
import { QUERY_KEYS } from '@/constants/queryKeys'; | ||
import { ROUTE_PATH } from '@/constants/routePath'; | ||
|
||
const usePostSignInQuery = () => { | ||
const navigate = useNavigate(); | ||
const queryClient = useQueryClient(); | ||
return useMutation({ | ||
mutationFn: postSignIn, | ||
onSuccess: () => { | ||
queryClient.invalidateQueries({ queryKey: [QUERY_KEYS.AUTH] }); | ||
navigate(ROUTE_PATH.home); | ||
}, | ||
}); | ||
}; | ||
|
||
export default usePostSignInQuery; |
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