import axios from 'axios'; import { API_URL } from '../constants'; const existingToken = localStorage.getItem('token'); export const backend = axios.create({ baseURL: API_URL, headers: { 'Content-type': 'application/json', }, }); // Add token if already in local storage if (existingToken) { backend.defaults.headers.common['Authorization'] = JSON.parse(existingToken); }