File size: 337 Bytes
90f0c0b
 
 
bcebe14
90f0c0b
 
d5c13b8
 
 
 
 
f63667d
d5c13b8
 
 
 
 
f63667d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import axios from "axios";

const API = axios.create({
  baseURL: "/api/v1",
});

// Attach token automatically for every request
API.interceptors.request.use((config) => {
  const token = localStorage.getItem("token");

  if (token) {
    config.headers.Authorization = `Bearer ${token}`;
  }

  return config;
});

export default API;