Message from JavaScript discussions

January 2019

— 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)

Message permanent page


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

— 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

— Am using vue cli 3 so it come with

new Vue({
render: h => h(App)