import dataProvider from '@refinedev/simple-rest' import axios from 'axios' import {BACKEND_URL} from '../lib/constants' import {TOKEN_KEY} from '../authProvider' import Cookies from 'js-cookie' export const axiosInstance = axios.create() axiosInstance.interceptors.request.use((config) => { // Добавляем токен авторизации const token = localStorage.getItem(TOKEN_KEY) if (token) { config.headers.Authorization = `Bearer ${token}` } // Добавляем язык в кастомный заголовок const lang = Cookies.get('lang') || 'ru' config.headers['X-Language'] = lang // или 'Accept-Language' // console.log('Request headers:', config.headers) return config }) export const customDataProvider = dataProvider(BACKEND_URL, axiosInstance)