landing page added

This commit is contained in:
nabijonovdavronbek619@gmail.com
2026-04-01 01:22:31 +05:00
parent 291375ce02
commit 80343c9ca8
34 changed files with 1262 additions and 49 deletions

View File

@@ -0,0 +1,29 @@
import axios, { AxiosRequestConfig, AxiosResponse } from 'axios';
import { getRouteLang } from './getLanguage';
const baseUrl = process.env.NEXT_PUBLIC_API_BASE_URL;
const api = axios.create({
baseURL: baseUrl,
});
export const apiRequest = async <T>(
method: 'GET' | 'POST' | 'PUT' | 'DELETE',
url: string,
data?: unknown,
config?: Omit<AxiosRequestConfig, 'method' | 'url' | 'data'>,
): Promise<T> => {
const response: AxiosResponse<T> = await api.request<T>({
method,
url,
data,
...config,
headers: {
'Accept-Language': getRouteLang(), // evaluated per-request
...config?.headers,
},
});
return response.data;
};