mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-26 01:06:23 +02:00
feat: add current user query atom
This commit is contained in:
parent
d5997a6d0c
commit
cee27f1263
1 changed files with 13 additions and 0 deletions
13
surfsense_web/atoms/user/user-query.atoms.ts
Normal file
13
surfsense_web/atoms/user/user-query.atoms.ts
Normal 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();
|
||||
},
|
||||
};
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue