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
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.
Comments