diff --git a/src/server/static-react/src/components/Header.tsx b/src/server/static-react/src/components/Header.tsx index fa7fdd32..c226a78f 100644 --- a/src/server/static-react/src/components/Header.tsx +++ b/src/server/static-react/src/components/Header.tsx @@ -137,7 +137,7 @@ function Header({ onSettingsClick, onAiSettingsClick, onCloudSettingsClick }: He let cancelled = false const checkOrgSync = async () => { try { - const hash = localStorage.getItem('fold_user_hash') + const hash = localStorage.getItem(BROWSER_CONFIG.STORAGE_KEYS.USER_HASH) if (!hash) return const res = await defaultApiClient.get('/org') const data = ((res as { data?: unknown }).data ?? res) as { orgs?: Array<{ org_hash: string }> } diff --git a/src/server/static-react/src/components/data-browser/shared.tsx b/src/server/static-react/src/components/data-browser/shared.tsx index 20cd35ad..3aa3e88f 100644 --- a/src/server/static-react/src/components/data-browser/shared.tsx +++ b/src/server/static-react/src/components/data-browser/shared.tsx @@ -2,6 +2,7 @@ import { useCallback, useEffect, useState } from 'react' import { InboxArrowDownIcon } from '@heroicons/react/24/outline' import { mutationClient } from '../../api/clients' import { SCHEMA_BADGE_COLORS } from '../../constants/ui' +import { BROWSER_CONFIG } from '../../constants/config' import { createHashRangeKeyFilter, createHashKeyFilter, @@ -241,7 +242,7 @@ export function VersionHistory({ moleculeUuid }: { moleculeUuid: string | null | const IMAGE_EXTENSIONS = /\.(jpe?g|png|gif|webp|svg)$/i function authHeaders(): Record { - const userHash = localStorage.getItem('fold_user_hash') + const userHash = localStorage.getItem(BROWSER_CONFIG.STORAGE_KEYS.USER_HASH) if (!userHash) return {} return { 'x-user-hash': userHash, 'x-user-id': userHash } } diff --git a/src/server/static-react/src/components/settings/OrgSettingsPanel.tsx b/src/server/static-react/src/components/settings/OrgSettingsPanel.tsx index db331b3f..f4e61783 100644 --- a/src/server/static-react/src/components/settings/OrgSettingsPanel.tsx +++ b/src/server/static-react/src/components/settings/OrgSettingsPanel.tsx @@ -2,6 +2,7 @@ import { useState, useEffect, useRef, type FormEvent } from 'react' import { defaultApiClient } from '../../api/core/client' import { systemClient } from '../../api/clients/systemClient' import { orgClient, type OrgInviteBundle, type OrgMemberInfo, type CloudMember } from '../../api/clients/orgClient' +import { BROWSER_CONFIG } from '../../constants/config' interface Org { org_hash: string @@ -52,7 +53,7 @@ export default function OrgSettingsPanel() { useEffect(() => { const doFetch = () => { - const hash = localStorage.getItem('fold_user_hash') + const hash = localStorage.getItem(BROWSER_CONFIG.STORAGE_KEYS.USER_HASH) if (!hash) { const timer = setTimeout(doFetch, 1000) return () => clearTimeout(timer) diff --git a/src/server/static-react/src/components/tabs/IngestionTab.tsx b/src/server/static-react/src/components/tabs/IngestionTab.tsx index e11cc9f9..27eb3dda 100644 --- a/src/server/static-react/src/components/tabs/IngestionTab.tsx +++ b/src/server/static-react/src/components/tabs/IngestionTab.tsx @@ -4,6 +4,7 @@ import { ingestionClient } from '../../api/clients' import { defaultApiClient } from '../../api/core/client' import { generateBlogPosts } from '../../data/sampleBlogPosts' import { twitterSamples, instagramSamples, linkedinSamples, tiktokSamples } from '../../data/sampleSocialPosts' +import { BROWSER_CONFIG } from '../../constants/config' const SAMPLES_ENABLED = import.meta.env.VITE_ENABLE_SAMPLES === 'true' @@ -31,7 +32,7 @@ function IngestionTab({ onResult }: IngestionTabProps) { const maxRetries = 5 const fetchOrgs = () => { if (cancelled) return - const hash = localStorage.getItem('fold_user_hash') + const hash = localStorage.getItem(BROWSER_CONFIG.STORAGE_KEYS.USER_HASH) if (!hash) { retries++ if (retries < maxRetries) setTimeout(fetchOrgs, 1000) diff --git a/src/server/static-react/src/components/tabs/SmartFolderTab.tsx b/src/server/static-react/src/components/tabs/SmartFolderTab.tsx index 99c5ae27..4f5254c1 100644 --- a/src/server/static-react/src/components/tabs/SmartFolderTab.tsx +++ b/src/server/static-react/src/components/tabs/SmartFolderTab.tsx @@ -11,6 +11,7 @@ import { useFilesProgress } from '../../hooks/useFilesProgress' import FolderInput from './smart-folder/FolderInput' import ScanResultsView from './smart-folder/ScanResultsView' import BatchProgressView from './smart-folder/BatchProgressView' +import { BROWSER_CONFIG } from '../../constants/config' const STORAGE_KEY = 'smartFolderTabState' @@ -90,7 +91,7 @@ function SmartFolderTab({ onResult: onResultProp }: SmartFolderTabProps) { const maxRetries = 5 const fetchOrgs = () => { if (cancelled) return - const hash = localStorage.getItem('fold_user_hash') + const hash = localStorage.getItem(BROWSER_CONFIG.STORAGE_KEYS.USER_HASH) if (!hash) { retries++ if (retries < maxRetries) setTimeout(fetchOrgs, 1000) diff --git a/src/server/static-react/src/components/tabs/llm-query/ImageThumbnail.tsx b/src/server/static-react/src/components/tabs/llm-query/ImageThumbnail.tsx index bdbe3fcb..2c898ebc 100644 --- a/src/server/static-react/src/components/tabs/llm-query/ImageThumbnail.tsx +++ b/src/server/static-react/src/components/tabs/llm-query/ImageThumbnail.tsx @@ -1,4 +1,5 @@ import { useEffect, useState } from 'react' +import { BROWSER_CONFIG } from '../../../constants/config' interface ImageThumbnailProps { fileHash: string @@ -12,7 +13,7 @@ export default function ImageThumbnail({ fileHash, sourceFile }: ImageThumbnailP useEffect(() => { const url = `/api/file/${fileHash}?name=${encodeURIComponent(sourceFile || '')}` let revoked = false - const userHash = localStorage.getItem('fold_user_hash') + const userHash = localStorage.getItem(BROWSER_CONFIG.STORAGE_KEYS.USER_HASH) const headers: Record = {} if (userHash) { headers['x-user-hash'] = userHash