In my Nuxt.js project, I organized the file directories as follows:
/* Create a axios instance with custom headers */
import axios from 'axios';
let myVariable = someVariable //someVariable is the result from // asynchronous
//request with axios in some web page component, how can I get
// variable?
// with vuex?
const myAxios = axios.create({
headers: {'X-My-Variable': myVariable}
});
export default myAxios;
A web page component fetches a result from an asynchronous request, and I want to use this result in another JavaScript file or third-party library. Where should I store the result of the asynchronous request, and how can I access it regardless of changes in the route?