Connect Schedule to API and

This commit is contained in:
2020-08-22 22:49:03 +02:00
parent 3356c380d7
commit 017f6e3869
6 changed files with 130 additions and 36 deletions

View File

@@ -1,9 +1,15 @@
import axios from 'axios';
import { API_URL } from '../constants';
const existingToken = JSON.parse(localStorage.getItem('token'));
export const backend = axios.create({
baseURL: API_URL,
headers: {
'Content-type': 'application/json',
},
});
if (existingToken) {
backend.defaults.headers['Authorization'] = existingToken;
}