From 95972b329e87234847111b99e839c61c88bf9232 Mon Sep 17 00:00:00 2001 From: orion Date: Wed, 15 Apr 2026 05:04:11 +0000 Subject: [PATCH] fix(api): handle null return type for localStorage getItem --- src/App.tsx | 2 +- src/services/api.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 085db9c..335f93e 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -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 getApiBase = () => { - return localStorage.getItem('HF_BACKEND_BASE_URL') + return localStorage.getItem('HF_BACKEND_BASE_URL') ?? undefined } type AppState = 'checking' | 'setup' | 'ready' diff --git a/src/services/api.ts b/src/services/api.ts index 5bee417..477bd30 100644 --- a/src/services/api.ts +++ b/src/services/api.ts @@ -1,7 +1,7 @@ import axios from 'axios' -const getApiBase = () => { - return localStorage.getItem('HF_BACKEND_BASE_URL') +const getApiBase = (): string | undefined => { + return localStorage.getItem('HF_BACKEND_BASE_URL') ?? undefined } const api = axios.create({