fix: error type

This commit is contained in:
ValdiANS
2025-09-30 15:44:48 +07:00
parent a364a860fa
commit 3be69eeff8
+3 -7
View File
@@ -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;
}
}