fix(api): handle null return type for localStorage getItem

This commit is contained in:
2026-04-15 05:04:11 +00:00
parent 1a20a1050b
commit 95972b329e
2 changed files with 3 additions and 3 deletions

View File

@@ -26,7 +26,7 @@ const WIZARD_PORT = Number(import.meta.env.VITE_WIZARD_PORT) || 18080
const WIZARD_BASE = `http://127.0.0.1:${WIZARD_PORT}` const WIZARD_BASE = `http://127.0.0.1:${WIZARD_PORT}`
const getApiBase = () => { const getApiBase = () => {
return localStorage.getItem('HF_BACKEND_BASE_URL') return localStorage.getItem('HF_BACKEND_BASE_URL') ?? undefined
} }
type AppState = 'checking' | 'setup' | 'ready' type AppState = 'checking' | 'setup' | 'ready'

View File

@@ -1,7 +1,7 @@
import axios from 'axios' import axios from 'axios'
const getApiBase = () => { const getApiBase = (): string | undefined => {
return localStorage.getItem('HF_BACKEND_BASE_URL') return localStorage.getItem('HF_BACKEND_BASE_URL') ?? undefined
} }
const api = axios.create({ const api = axios.create({