mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-25 19:15:18 +02:00
chore: update .gitignore to include connector status config and enhance user query atom to fetch data only when a bearer token is present
This commit is contained in:
parent
7ac7cd5f99
commit
f62d4cb99c
2 changed files with 5 additions and 0 deletions
2
surfsense_web/.gitignore
vendored
2
surfsense_web/.gitignore
vendored
|
|
@ -50,3 +50,5 @@ next-env.d.ts
|
||||||
|
|
||||||
.pnpm-store/
|
.pnpm-store/
|
||||||
|
|
||||||
|
# Connector status config (use .example.json as template)
|
||||||
|
components/assistant-ui/connector-popup/config/connector-status-config.json
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,14 @@
|
||||||
import { atomWithQuery } from "jotai-tanstack-query";
|
import { atomWithQuery } from "jotai-tanstack-query";
|
||||||
import { userApiService } from "@/lib/apis/user-api.service";
|
import { userApiService } from "@/lib/apis/user-api.service";
|
||||||
|
import { getBearerToken } from "@/lib/auth-utils";
|
||||||
import { cacheKeys } from "@/lib/query-client/cache-keys";
|
import { cacheKeys } from "@/lib/query-client/cache-keys";
|
||||||
|
|
||||||
export const currentUserAtom = atomWithQuery(() => {
|
export const currentUserAtom = atomWithQuery(() => {
|
||||||
return {
|
return {
|
||||||
queryKey: cacheKeys.user.current(),
|
queryKey: cacheKeys.user.current(),
|
||||||
staleTime: 5 * 60 * 1000, // 5 minutes
|
staleTime: 5 * 60 * 1000, // 5 minutes
|
||||||
|
// Only fetch user data when a bearer token is present
|
||||||
|
enabled: !!getBearerToken(),
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
return userApiService.getMe();
|
return userApiService.getMe();
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue