You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
354 B
14 lines
354 B
/* Custom axios instance that adds the token to the headers, if existent */ |
|
import axios from "axios"; |
|
import UserManager from "./UserService"; |
|
|
|
axios.interceptors.request.use(function (config) { |
|
const token = UserManager.getToken(); |
|
|
|
if (token) { |
|
config.headers.Authorization = "Bearer " + token; |
|
} |
|
return config; |
|
}); |
|
|
|
export default axios;
|
|
|