K
K
korchuni2019-12-24 19:44:43
JavaScript
korchuni, 2019-12-24 19:44:43

How to handle promise immediately after dispatch Vue JS?

The problem is that I don’t understand how you can immediately get a response and process it, let’s say there are mounted and computed methods that help to calmly receive data:

mounted(){
    this.$store.dispatch('NAME_OF_ACTION')
},
computed: {
    getSth() { return this.$store.getters.NAME }
}

But, what if you need to immediately get some kind of Promise and insert data from it?
this.$store.dispatch('NAME_OF_ACTION').then(promise => console.log(promise))

Thus, nothing can be obtained, except that some actions are independent of this request.
Accordingly, how can you immediately process the data, what options are there? (new to VUE)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question