feat: add current user query atom

This commit is contained in:
CREDO23 2025-12-15 12:07:47 +00:00
parent d5997a6d0c
commit cee27f1263

View file

@ -0,0 +1,13 @@
import { atomWithQuery } from "jotai-tanstack-query";
import { userApiService } from "@/lib/apis/user-api.service";
import { cacheKeys } from "@/lib/query-client/cache-keys";
export const currentUserAtom = atomWithQuery(() => {
return {
queryKey: cacheKeys.user.current(),
staleTime: 5 * 60 * 1000, // 5 minutes
queryFn: async () => {
return userApiService.getMe();
},
};
});