Why my first load data axios is return 404 Vue Js?

Dicki Maulana Yusuf

so guys I've tried to fetch data and show it inside my component. But the problem is, fetching data got 404 or data not show for the first load.. but when I try to reload again data is shown as should be. And one thing.. the data was success upload to the server even the response status 404 as I said

By the way guys this is my reviewClient.js

getDraft() {
  return api.get("/reviews/draft")
}

this is my Store

async fetchDraft({ commit }) {
  try {
    let {
      data: { data }
    } = await reviewClient.getDraft()
    commit("SET_DRAFT", data)
  } catch (error) {
    return Promise.reject(error)
  }
}

and this is how I call fetchDraft from a store inside my component

async created() {
  await this.getDraft()
}

methods: {
  async getDraft() {
    try {
      await this.$store.dispatch("review/fetchDraft")
      this.scrollToTop()
    } catch (error) {
      error
    }
  }
}

this is a sample of my problem above

https://ibb.co/k6xyRc3

Dicki Maulana Yusuf

Thanks, guys for the answers. This problem solved by awaiting the data to create on the previous step before the preview (create_step.vue). And also check on network tabs

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Why does my WebClient return a 404 error most of the time, but not always?

From Dev

Why does nginx return 404 on my Kubernetes Ingress route?

From Dev

Why does my Angular POST request for PHP file return 404?

From Dev

Vue JS Load dynamic Data issue with Modal

From Dev

Why does vue.js statement with axios start later?

From Dev

js map why is not changing my value with return

From Dev

Vue.js why my watcher is not working?

From Dev

Why does my website load and show the bottom of the page first?

From Dev

Why does my website load and show the bottom of the page first?

From Dev

Vue.js: Why won't my data display in this list containing multiple component types?

From Dev

Why is my bulma modal not displaying when data is set to true? (Vue.js)

From Dev

Axios not loading data to vue

From Dev

React: Using Axios so I can use data from my first request in my second one

From Dev

iOS - Why reloadData tableView data on first application load?

From Dev

Creating my first Vue.js app with WebStorm

From Dev

Ember JS: How to load a second model based on data from a first

From Dev

Ember JS: How to load a second model based on data from a first

From Dev

Why doesn't JSON data load immediately in my HTML page?

From Dev

Why can't I load js and css files on my pages?

From Dev

Why can't I load js and css files on my pages?

From Dev

Vue - why can't I display the result of my axios get request in vuex?

From Dev

Why is my variable data getting dropped after the first foreach loop?

From Dev

Why is my variable data getting dropped after the first foreach loop?

From Dev

Why i am not getting the data in first call to my REST API

From Dev

Why does my db query return zero(no data) in the required coloumns

From Dev

Why does my function not return the data I expect?

From Dev

Why do my requests with file extensions return 404 if slash is omitted before Query Identifier?

From Dev

Why do my requests with file extensions return 404 if slash is omitted before Query Identifier?

From Dev

Why is not my HTML form sending the data to my JS file?

Related Related

  1. 1

    Why does my WebClient return a 404 error most of the time, but not always?

  2. 2

    Why does nginx return 404 on my Kubernetes Ingress route?

  3. 3

    Why does my Angular POST request for PHP file return 404?

  4. 4

    Vue JS Load dynamic Data issue with Modal

  5. 5

    Why does vue.js statement with axios start later?

  6. 6

    js map why is not changing my value with return

  7. 7

    Vue.js why my watcher is not working?

  8. 8

    Why does my website load and show the bottom of the page first?

  9. 9

    Why does my website load and show the bottom of the page first?

  10. 10

    Vue.js: Why won't my data display in this list containing multiple component types?

  11. 11

    Why is my bulma modal not displaying when data is set to true? (Vue.js)

  12. 12

    Axios not loading data to vue

  13. 13

    React: Using Axios so I can use data from my first request in my second one

  14. 14

    iOS - Why reloadData tableView data on first application load?

  15. 15

    Creating my first Vue.js app with WebStorm

  16. 16

    Ember JS: How to load a second model based on data from a first

  17. 17

    Ember JS: How to load a second model based on data from a first

  18. 18

    Why doesn't JSON data load immediately in my HTML page?

  19. 19

    Why can't I load js and css files on my pages?

  20. 20

    Why can't I load js and css files on my pages?

  21. 21

    Vue - why can't I display the result of my axios get request in vuex?

  22. 22

    Why is my variable data getting dropped after the first foreach loop?

  23. 23

    Why is my variable data getting dropped after the first foreach loop?

  24. 24

    Why i am not getting the data in first call to my REST API

  25. 25

    Why does my db query return zero(no data) in the required coloumns

  26. 26

    Why does my function not return the data I expect?

  27. 27

    Why do my requests with file extensions return 404 if slash is omitted before Query Identifier?

  28. 28

    Why do my requests with file extensions return 404 if slash is omitted before Query Identifier?

  29. 29

    Why is not my HTML form sending the data to my JS file?

HotTag

Archive