move API url to config

This commit is contained in:
Gauthier Roebroeck 2025-06-11 10:26:36 +08:00
parent fb59df23ab
commit 2b25cc9942
3 changed files with 17 additions and 1 deletions

1
next-ui/.env.development Normal file
View file

@ -0,0 +1 @@
VITE_KOMGA_API_URL=http://localhost:8080

View file

@ -35,7 +35,7 @@ const coladaMiddleware: Middleware = {
}
const client = createClient<paths>({
baseUrl: 'http://localhost:8080',
baseUrl: import.meta.env.VITE_KOMGA_API_URL,
// required to pass the session cookie on all requests
credentials: 'include',
// required to avoid browser basic-auth popups

15
next-ui/src/vite-env.d.ts vendored Normal file
View file

@ -0,0 +1,15 @@
/// <reference types="vite/client" />
interface ViteTypeOptions {
// By adding this line, you can make the type of ImportMetaEnv strict
// to disallow unknown keys.
strictImportMetaEnv: unknown
}
interface ImportMetaEnv {
readonly VITE_KOMGA_API_URL: string
}
interface ImportMeta {
readonly env: ImportMetaEnv
}