/
pellya
/
blogReactera
Обзор
Документация
Войти
/
pellya
/
blogReactera
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
src/shared/api/api.ts
17 строк
477 B
rpellya@gmail.com
Add some fix for public project
04 фев 2025, 00:20
04 фев 2025, 00:20
b760fc8
Код
Авторство
О чём код?
import axios from 'axios'; import { USER_LOCALSTORAGE_KEY } from 'shared/const/localStorage'; // for example // const baseUrl = __IS_DEV__ ? 'http://localhost:8000' : 'https://yandex.ru'; export const $api = axios.create({ baseURL: __API__, }); // Error at the first entry to the site $api.interceptors.request.use(config => { if (config.headers) { config.headers.authorization = localStorage.getItem(USER_LOCALSTORAGE_KEY) || ''; } return config })