261120_01_FIX: 삭제·권한 없는 프로젝트의 리스트 작업 기록이 남아 403이 반복 조회되는 문제 수정
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
"use client";
|
||||
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import { useSetAtom } from "jotai";
|
||||
import { nextApi } from "@/lib/http-client";
|
||||
import { useAuth } from "@/hooks/useAuth";
|
||||
import { useSelectedProject } from "@/hooks/useSelectedProject";
|
||||
import { clearTrackedListJobs } from "@/store/list-job-tracker";
|
||||
import { listJobOpenRequestAtom } from "@/store/jotai/list-job";
|
||||
import type { LoginUser } from "@kri/common";
|
||||
|
||||
export const useLoginMutation = () => {
|
||||
@@ -31,6 +34,7 @@ export const useLogoutMutation = () => {
|
||||
const qc = useQueryClient();
|
||||
const { auth, logout } = useAuth();
|
||||
const { clearSelectedProject } = useSelectedProject();
|
||||
const setListJobOpenRequest = useSetAtom(listJobOpenRequestAtom);
|
||||
|
||||
return useMutation({
|
||||
mutationFn: async () => {
|
||||
@@ -49,6 +53,8 @@ export const useLogoutMutation = () => {
|
||||
},
|
||||
onSettled: () => {
|
||||
clearSelectedProject();
|
||||
clearTrackedListJobs();
|
||||
setListJobOpenRequest(null);
|
||||
logout();
|
||||
qc.clear(); // 다음 사용자/세션에 서버상태 남지 않게
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user