aboutsummaryrefslogtreecommitdiff
path: root/src/requests.ts
blob: 42b5b951ec59e40a58e96a98dd0ceda02e39b65d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import axios from 'axios';
import _ from 'lodash';

const requests = axios.create({
  baseURL: 'http://localhost:3030'
});

requests.interceptors.request.use(config => {
  const token = localStorage.getItem('token');
  return _.set(config, 'headers.Authorization', token);
});

export const { get, post, put, patch } = requests;
export default requests;