mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-10 04:22:27 +10:00
refactor(auth): streamline logout process by clearing query data
This commit is contained in:
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"css.validate": false,
|
"css.validate": false,
|
||||||
"typescript.tsdk": "node_modules/typescript/lib",
|
"i18n-ally.localesPaths": ["apps/client/src/locales"],
|
||||||
"tailwindCSS.experimental.classRegex": [
|
"tailwindCSS.experimental.classRegex": [
|
||||||
["cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"],
|
["cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"],
|
||||||
["cn\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"]
|
["cn\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"]
|
||||||
],
|
],
|
||||||
"i18n-ally.localesPaths": ["apps/client/src/locales"]
|
"typescript.tsdk": "node_modules/typescript/lib"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import { useMutation } from "@tanstack/react-query";
|
import { useMutation } from "@tanstack/react-query";
|
||||||
|
|
||||||
import { RESUMES_KEY, USER_KEY } from "@/client/constants/query-keys";
|
|
||||||
import { axios } from "@/client/libs/axios";
|
import { axios } from "@/client/libs/axios";
|
||||||
import { queryClient } from "@/client/libs/query-client";
|
import { queryClient } from "@/client/libs/query-client";
|
||||||
import { useAuthStore } from "@/client/stores/auth";
|
import { useAuthStore } from "@/client/stores/auth";
|
||||||
@ -18,13 +17,11 @@ export const useLogout = () => {
|
|||||||
mutationFn: logout,
|
mutationFn: logout,
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
setUser(null);
|
setUser(null);
|
||||||
queryClient.setQueryData(USER_KEY, null);
|
queryClient.clear();
|
||||||
queryClient.setQueryData(RESUMES_KEY, null);
|
|
||||||
},
|
},
|
||||||
onError: () => {
|
onError: () => {
|
||||||
setUser(null);
|
setUser(null);
|
||||||
queryClient.setQueryData(USER_KEY, null);
|
queryClient.clear();
|
||||||
queryClient.setQueryData(RESUMES_KEY, null);
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user