Axios-module: axios module Interceptors not working with vuex

Created on 12 Jan 2019  路  2Comments  路  Source: nuxt-community/axios-module

am new to nuxtjs vuex and axios as my project getting bigger i choose to build with nuxt/axios and nuxt/auth but after loginedin when i go to jwt protected route from my api its showing me error 401. then i try to use axios module Interceptors to send auth user token in the header using bearer token.

inside '~/plugins/axios'


export default function ({ $axios, redirect }) {
  $axios.onRequest(config => {
    this.$axios.setToken('123', 'Bearer')
  })
}

inside 'store.js'


export const actions = {
    async load_cdata ({commit}, url){
        const {data} = await axios.get(url)

        commit('setData', data)

    },

then i get error

_plugins_axios__WEBPACK_IMPORTED_MODULE_3__.default.get is not a function

PLEASE ANY ONEWHO KNOW HOW TO USE NUXT/AXIOS MODULE INTERCEPTORS WITH NUXTJS

This question is available on Nuxt community (#c202)
question

All 2 comments

This issue as been imported as question since it does not respect axios-module issue template. Only bug reports and feature requests stays open to reduce maintainers workload.
If your issue is not a question, please mention the repo admin or moderator to change its type and it will be re-opened automatically.
Your question is available at https://cmty.app/nuxt/axios-module/issues/c202.

Why was this issue closed?

What was the solution?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ealves-pt picture ealves-pt  路  3Comments

lyzs90 picture lyzs90  路  4Comments

WtekSupport picture WtekSupport  路  6Comments

artmarydotir picture artmarydotir  路  4Comments

simllll picture simllll  路  6Comments