0👍
You can set http headers using config,
// where populate secret-token-1 from cookies or available web resources
Vue.http.headers.common['Authorization'] = 'Token secret-token-1';
it will send header for every requests, if you are using vue-resource
for sending header for specific request,
this.$http.get('/api/name', function(node) {
// handle response
}, {headers: {'Authorization': 'Token secret-token-1'}});
Note: use a common functions like get_authtoken
, where i hard coded the token 🙂
- [Vuejs]-In vue.js when building for production, I get a 404 error on files inside the static folder, even when the URL is correct
- [Vuejs]-Failed to mount component: template or render function not defined in Vue with Typescript & Webpack,
Source:stackexchange.com