Connect Schedule to API and
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user