Closed bahek2462774 closed 6 years ago
To get axios
you can just import it at the top of your nuxt.config.js
:
// nuxt.config.js
const { get } = require('axios')
module.exports = {
oauth: {
fetchUser: async token => {
const { data } = await get(`https://my.api.com/me?token=${token}`)
return data
}
}
}
I'm not sure it's possible to get access to the vue store, as this whole thing happens on the server before the Vue instance is even created and before nuxt is initialised.
If you can give me some more information about your situation maybe I can help more 👍
It's enough. Thanks a lot!
How can I get access to the axios or vue store inside this method fetchUser?. Or how am I supposed to implement fetching user? Thanks!