mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 21:41:57 +00:00
fix: error type
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import axios from 'axios';
|
||||
import type { AxiosRequestConfig } from 'axios';
|
||||
import { HttpError, RequestOptions } from '@/services/http/base';
|
||||
import { RequestOptions } from '@/services/http/base';
|
||||
|
||||
const BASE_URL = process.env.NEXT_PUBLIC_API_BASE_URL ?? '';
|
||||
const axiosClient = axios.create({ baseURL: BASE_URL, timeout: 10_000 });
|
||||
@@ -29,12 +29,8 @@ export async function httpClient<T, B = unknown>(
|
||||
try {
|
||||
const res = await axiosClient.request<T>(config);
|
||||
return res.data;
|
||||
} catch (e: any) {
|
||||
if (axios.isAxiosError(e)) {
|
||||
throw e;
|
||||
}
|
||||
|
||||
throw new HttpError(e.response?.status ?? 0, e.code, e.response?.data);
|
||||
} catch (e: unknown) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user