vue-async-computed
vue-async-computed copied to clipboard
Use with Nuxt?
Sorry for a noob question, but how do I use it with Nuxt?
@vzakharov just install the package and register it as a plugin
myPlugin.client.js
import Vue from 'vue'
import AsyncComputed from 'vue-async-computed'
Vue.use(AsyncComputed)
then in your component, use
myComponent.vue
export default {
asyncComputed: {
async myResolvedValue() {
return await api.get(`/users/${this.value.username}/message/`, {'headers': { 'Authorization': 'JWT ...' }})
.then(response => response.data)
}
}
}