0๐
โ
Do this work?
this.$http.interceptors.request.use(
config => {
const token=this.$store.getters.getToken;
if (token) {
config.headers.Authorization = "Token " + token;
}
return config;
}
);
this.$http.post('posts/', {'text': 'asdasd'})
Source:stackexchange.com