0👍
Vue and Nuxt plugins define properties on component instances. this
inside an action is not component instance and so isn’t supposed to have this.$axios
. It’s an outdated and questionable practice to use loosely defined this
dynamic context anywhere besides strict OOP code.
It’s incorrect way yo use an action. A store should be imported instead of an action:
import store from '.../store`.
It’s incorrect way to import Axios. It should be explicitly imported in non-component modules. In case there’s Axios instance with interceptors, etc, it can be maintained within a module:
import axios from '.../common/axios`.
Source:stackexchange.com