/** * Runtime OpenAPI configuration. * * Reads the API base URL from `import.meta.env.VITE_API_BASE_URL` and points * `@aetoskia/react-openapi` at `${base}/openapi.json`, sets the app title, * and wires the auth token from `@aetoskia/react-auth` into every API call. * * @packageDocumentation */ import type { SpecConfiguration } from "@aetoskia/react-openapi"; import { tokenStore } from "@aetoskia/react-auth"; const apiBase = import.meta.env.VITE_API_BASE_URL; /** * The `SpecConfiguration` passed to `AppProvider`. * * - `specUrl` / `baseApiUrl` - derived from `VITE_API_BASE_URL`. * - `title` - replace "App Title" with your application's name. * - `getToken` - supplies the JWT from `@aetoskia/react-auth` to every * request made through `getApi()` / `useResource()`. */ export const specConfiguration: SpecConfiguration = { specUrl: `${apiBase}/openapi.json`, baseApiUrl: apiBase, title: "App Title", getToken: () => tokenStore.get(), };