feat: custom request headers
This commit is contained in:
parent
bc293b8fef
commit
85882f7c7a
@ -59,6 +59,7 @@ export class APIClient {
|
|||||||
authMiddleware() {
|
authMiddleware() {
|
||||||
this.axios.interceptors.request.use((config) => {
|
this.axios.interceptors.request.use((config) => {
|
||||||
const token = localStorage.getItem(this.tokenKey);
|
const token = localStorage.getItem(this.tokenKey);
|
||||||
|
config.headers['X-Hostname'] = window.location.hostname;
|
||||||
if (token) {
|
if (token) {
|
||||||
config.headers['Authorization'] = `Bearer ${token}`;
|
config.headers['Authorization'] = `Bearer ${token}`;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user