Skip to content

Commit

Permalink
update query key to use cache tag instead of hardcoded string
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan-Y-Ko committed Nov 14, 2024
1 parent faceab2 commit 44318bb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/app/(main)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { getUserState } from "@/store/features/user/userSlice";
import { TYPES } from "@/di/types";
import { resolve } from "@/di/resolver";
import Spinner from "@/components/Spinner";
import { CacheTag } from "@/utils/cacheTag";

interface LayoutProps {
children: React.ReactNode;
Expand All @@ -25,7 +26,7 @@ export default function Layout({ children }: LayoutProps) {
const router = useRouter();

const { isPending, isError, data } = useQuery({
queryKey: ["user"],
queryKey: [CacheTag.me],
queryFn: getUserQuery,
staleTime: 1000 * 60 * 30, // This sets it to 30 minutes, which is how long the access token lasts
});
Expand Down

0 comments on commit 44318bb

Please sign in to comment.