ci: add api path

This commit is contained in:
Zotov Ivan Yuryevich
2026-05-01 19:02:18 +03:00
parent 8931d9514a
commit 58443e047e
4 changed files with 27 additions and 40 deletions

View File

@@ -2,6 +2,16 @@ import createClient from 'openapi-fetch'
import { type schema } from './schema'
function getApiBaseUrl(): string {
if (typeof import.meta !== 'undefined' && import.meta.env?.PUBLIC_API_URL) {
return import.meta.env.PUBLIC_API_URL
}
if (typeof process !== 'undefined' && process.env.PUBLIC_API_URL) {
return process.env.PUBLIC_API_URL
}
return 'http://localhost:1337/api/'
}
export const client = createClient<schema>({
baseUrl: 'http://localhost:1337/api/',
baseUrl: getApiBaseUrl(),
})