Answer the question
In order to leave comments, you need to log in
Why is the Vue app crashing?
The load test on the server has begun. If at this moment the client accesses the api, then the Vue + SSR application server crashes.
The request is executed in asyncData
async asyncData({store}) {
return Promise.all([
store.dispatch('func1'),
store.dispatch('func2'),
store.dispatch('func3'),
store.dispatch('func4',
]).then(values => {
return values;
});
},
Answer the question
In order to leave comments, you need to log in
Without delving into the implementation, usually they return from asyncData Promise<Object|void>
, and you have Promise<Array>
. Yes, an array is also an object, but Javascript's ways are inscrutable. This array is then passed to the router's next function in entry-client.js:16, which shouldn't be able to handle it either, and so on. etc.
One way or another, if asyncData is used only to fill the store, there is no point in passing anything to the resolve promise:
async asyncData ({ store }) {
await Promise.all([
store.dispatch('func1'),
store.dispatch('func2'),
store.dispatch('func3'),
store.dispatch('func4')
])
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question