Home

Issue: 2407

Access middleware variables from pages

[issue link]

I’m trying to use middleware output in pages without Vuex.
It seems inject is not available here and none of following work.

My middleware:

export default function (context) {
     console.log('middle ware')
     return axios.get('http://localhost:3000/api/test').then((res) => {
          //none of these work:
          context.my_var = res.data 
          inject('my_var', res.data) 
          return ({my_var: res.data})      
 })

Any idea?

This question is available on Nuxt.js community (#c2091)