Message from JavaScript discussions

January 2019

— What i want to do actually just make axios accessible globally with custom interceptors defined


Btw actually i will only call the defined axios object inside my modules (*.js) and will never call it from component tho (if that make any difference)

— There is so much weird stuff going on in your code.. Are you using npm for getting the packages you need ? Vue and Axios

Message permanent page

— Yes, using vue cli 3 and install axios with npm install axios

— Or vue add axios 🤔 i forgot it tbh

— Alright ! What do you want to do ? Whats the reason for Setting vues HTTP to axios instead

— Https://

— This si what i want to do

— I used to call axios in component, its easy

— But what i want to do is basically make the axios wrapped with config i made

— For more context, this is what my requestHandler do:

export function requestHandler (config) {
// Get token from function getToken
let token = getToken()
// Check token not null value
if (token) {
config.headers.authorization = `JWT ${token}`
return config

Message permanent page

— Alright, how is Vue available in main.js and not store/modules