diff --git a/src/app/(with-tracker)/(auth-required)/layout.tsx b/src/app/(with-tracker)/(auth-required)/layout.tsx index 08480b5..dff49c6 100644 --- a/src/app/(with-tracker)/(auth-required)/layout.tsx +++ b/src/app/(with-tracker)/(auth-required)/layout.tsx @@ -1,5 +1,6 @@ import { ReactElement } from 'react'; import { dehydrate, HydrationBoundary } from '@tanstack/react-query'; +import { Header } from '@/components'; import { PATHS } from '@/constants'; import { me } from '@/apis'; import { getQueryClient } from '@/utils/queryUtil'; diff --git a/src/components/auth-required/header/index.tsx b/src/components/auth-required/header/index.tsx index 8570b33..915dfc2 100644 --- a/src/components/auth-required/header/index.tsx +++ b/src/components/auth-required/header/index.tsx @@ -35,25 +35,17 @@ export const Header = () => { const barWidth = width < SCREENS.MBI ? 65 : 180; const client = useQueryClient(); - const { data: profiles } = useQuery({ - queryKey: [PATHS.ME], - queryFn: me, - }); - const { mutate: out } = useMutation({ mutationFn: logout, - onSuccess: async () => { - client - .getQueryCache() - .findAll() - .forEach((query) => { - client.setQueryData(query.queryKey, null); - }); - client.clear(); - router.replace('/'); - }, + onMutate: () => router.replace('/'), + onSuccess: () => client.removeQueries(), }); + const { data: profiles } = useQuery({ + queryKey: [PATHS.ME], + queryFn: me, + }); + useEffect(() => { const handleClickOutside = (e: MouseEvent) => open &&