mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-04 22:02:16 +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 { agentFlagsApiService } from "@/lib/apis/agent-flags-api.service";
|
||||
import { getBearerToken } from "@/lib/auth-utils";
|
||||
import { isAuthenticated } from "@/lib/auth-utils";
|
||||
|
||||
export const AGENT_FLAGS_QUERY_KEY = ["agent", "flags"] as const;
|
||||
|
||||
|
|
@ -12,6 +12,6 @@ export const AGENT_FLAGS_QUERY_KEY = ["agent", "flags"] as const;
|
|||
export const agentFlagsAtom = atomWithQuery(() => ({
|
||||
queryKey: AGENT_FLAGS_QUERY_KEY,
|
||||
staleTime: 10 * 60 * 1000,
|
||||
enabled: !!getBearerToken(),
|
||||
enabled: isAuthenticated(),
|
||||
queryFn: () => agentFlagsApiService.get(),
|
||||
}));
|
||||
|
|
|
|||
|
|
@ -1,26 +1,26 @@
|
|||
import { atomWithQuery } from "jotai-tanstack-query";
|
||||
import { modelConnectionsApiService } from "@/lib/apis/model-connections-api.service";
|
||||
import { getBearerToken } from "@/lib/auth-utils";
|
||||
import { isAuthenticated } from "@/lib/auth-utils";
|
||||
import { cacheKeys } from "@/lib/query-client/cache-keys";
|
||||
import { activeSearchSpaceIdAtom } from "../search-spaces/search-space-query.atoms";
|
||||
|
||||
export const globalModelConnectionsAtom = atomWithQuery(() => ({
|
||||
queryKey: cacheKeys.modelConnections.global(),
|
||||
enabled: !!getBearerToken(),
|
||||
enabled: isAuthenticated(),
|
||||
staleTime: 10 * 60 * 1000,
|
||||
queryFn: () => modelConnectionsApiService.getGlobalConnections(),
|
||||
}));
|
||||
|
||||
export const globalLlmConfigStatusAtom = atomWithQuery(() => ({
|
||||
queryKey: cacheKeys.modelConnections.globalConfigStatus(),
|
||||
enabled: !!getBearerToken(),
|
||||
enabled: isAuthenticated(),
|
||||
staleTime: 60 * 60 * 1000,
|
||||
queryFn: () => modelConnectionsApiService.getGlobalLlmConfigStatus(),
|
||||
}));
|
||||
|
||||
export const modelProvidersAtom = atomWithQuery(() => ({
|
||||
queryKey: cacheKeys.modelConnections.providers(),
|
||||
enabled: !!getBearerToken(),
|
||||
enabled: isAuthenticated(),
|
||||
staleTime: 60 * 60 * 1000,
|
||||
queryFn: () => modelConnectionsApiService.getModelProviders(),
|
||||
}));
|
||||
|
|
|
|||
|
|
@ -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