ci: add api path
This commit is contained in:
@@ -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(),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user