diff --git a/src/api/index.ts b/src/api/index.ts index cf6c3ad5..99b46089 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -3,7 +3,7 @@ import { recordError } from '@/utils/errorHandler'; import { createClient } from '@profcomff/api-uilib'; import { type Middleware } from 'openapi-fetch'; -const responseMiddleware: Middleware = { +const errorMiddleware: Middleware = { async onResponse({ response }) { const data = await response.clone(); if (!response.ok) { @@ -16,5 +16,5 @@ const responseMiddleware: Middleware = { }; const apiClient = createClient(import.meta.env.VITE_API_URL); -apiClient.use(responseMiddleware); +apiClient.use(errorMiddleware); export default apiClient;