Skip to content

Use with Nuxt? #115

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
vzakharov opened this issue Sep 25, 2021 · 1 comment
Open

Use with Nuxt? #115

vzakharov opened this issue Sep 25, 2021 · 1 comment

Comments

@vzakharov
Copy link

Sorry for a noob question, but how do I use it with Nuxt?

@athulanilthomas
Copy link

@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)
       }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants