fix loading feed
This commit is contained in:
parent
cf5494c15b
commit
95ea2a5f23
4 changed files with 54 additions and 71 deletions
|
@ -1,10 +1,8 @@
|
|||
import { paths } from './schema.ts'
|
||||
import createClient, { Client, Middleware } from 'openapi-fetch'
|
||||
import createClient, { Middleware } from 'openapi-fetch'
|
||||
import { dispatchMessage } from '../messageBus/messageBus.ts'
|
||||
|
||||
export type ApiClient = Client<paths>
|
||||
|
||||
export function initClient(): ApiClient {
|
||||
export const initClient = () => {
|
||||
const client = createClient<paths>({ baseUrl: import.meta.env.VITE_API_URL })
|
||||
const UnauthorizedHandlerMiddleware: Middleware = {
|
||||
async onResponse({ response }) {
|
||||
|
@ -17,3 +15,5 @@ export function initClient(): ApiClient {
|
|||
client.use(UnauthorizedHandlerMiddleware)
|
||||
return client
|
||||
}
|
||||
|
||||
export type ApiClient = ReturnType<typeof initClient>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue