trae-bot
Fix all linting errors in frontend and backend
8268e91
import axios from 'axios';
const client = axios.create({
baseURL: process.env.NEXT_PUBLIC_API_BASE_URL || '',
timeout: 10000,
});
client.interceptors.request.use((config) => {
if (typeof window !== 'undefined') {
const token = localStorage.getItem('token');
if (token && config.headers) {
config.headers.Authorization = `Bearer ${token}`;
}
}
return config;
});
client.interceptors.response.use(undefined, (error) => Promise.reject(error));
export const api = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
get: (...args: Parameters<typeof client.get>) => client.get(...args).then((response) => response.data as any),
// eslint-disable-next-line @typescript-eslint/no-explicit-any
post: (...args: Parameters<typeof client.post>) => client.post(...args).then((response) => response.data as any),
// eslint-disable-next-line @typescript-eslint/no-explicit-any
put: (...args: Parameters<typeof client.put>) => client.put(...args).then((response) => response.data as any),
// eslint-disable-next-line @typescript-eslint/no-explicit-any
delete: (...args: Parameters<typeof client.delete>) => client.delete(...args).then((response) => response.data as any),
};