Initial commit

This commit is contained in:
2026-03-28 17:16:33 +03:00
commit fe9aff3fec
167 changed files with 23898 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
import { clientMap } from '@/lib/api/client-map';
import { Method } from 'axios';
interface ApiRequestOptions {
url: string;
client: keyof typeof clientMap;
method?: Method;
data?: any;
params?: Record<string, any>;
}
export async function apiRequest<T = any>(options: ApiRequestOptions): Promise<T> {
const { url, client, method = 'get', data, params } = options;
const clientInstance = clientMap[client];
if (!url || !clientInstance) {
throw new Error(`Invalid API request: ${client} - ${url}`);
}
const response = await clientInstance.request<T>({ method, url, data, params });
return response.data;
}