mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-12 22:42:13 +02:00
fix(web):refresh dashboard session queries
This commit is contained in:
parent
be95f65c6b
commit
b37114f193
5 changed files with 25 additions and 20 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import { atomWithQuery } from "jotai-tanstack-query";
|
||||
import { userApiService } from "@/lib/apis/user-api.service";
|
||||
import { getBearerToken } from "@/lib/auth-utils";
|
||||
import { isAuthenticated } from "@/lib/auth-utils";
|
||||
|
||||
export const USER_QUERY_KEY = ["user", "me"] as const;
|
||||
const userQueryFn = () => userApiService.getMe();
|
||||
|
|
@ -12,7 +12,8 @@ export const currentUserAtom = atomWithQuery(() => {
|
|||
// are now pushed via Zero (queries.user.me()), so /users/me only
|
||||
// needs to fire once per session for the static profile fields.
|
||||
staleTime: Infinity,
|
||||
enabled: !!getBearerToken(),
|
||||
enabled: isAuthenticated(),
|
||||
retry: false,
|
||||
queryFn: userQueryFn,
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue