1

On pages/tags.vue I am using this to fetch my api :

async fetch () {
        this.fetchresults = await this.$http.$get('https://api.domain/tags')
        this.tags = this.fetchresults.results;
  },

Its working fine but when I try to do the same thing from layouts/default.vue 90% of the time the tags is empty, its seem to only work once when I update my code then when I refresh tags is empty again. I cant use async fetch from the layout ?

4
  • duplication of stackoverflow.com/questions/58205391/… Commented May 20, 2020 at 22:51
  • Thanks I saw that post but that really doesnt help, when I paste something on store/index.js I allways get a parse error. Commented May 21, 2020 at 8:55
  • try to use getters in layout Commented May 21, 2020 at 13:56
  • its ok I found the solution, I can use fetch() from components and its load fine if I do "fetchOnServer: false", its not SEO friendly but it work fine. Commented May 21, 2020 at 17:19

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.