Vuex: How to use promise to set initial state data

Created on 14 Dec 2015  路  2Comments  路  Source: vuejs/vuex

Hi

I am using NeDB in my project and also vuex. I am having issue to set initial data using promise since nedb returns value inside callback.

So how do we set initial state Data if we have a callback or either using a promise.

Most helpful comment

The Vue 2.0 examples don't seem to have a initialize data action anymore.

All 2 comments

Use empty/stubbed initial state, and have a dedicated action/mutation for "got initial data". (See the shopping cart or chat example)

The Vue 2.0 examples don't seem to have a initialize data action anymore.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gdelazzari picture gdelazzari  路  3Comments

taoeffect picture taoeffect  路  3Comments

jdittrich picture jdittrich  路  3Comments

matthewmorgan picture matthewmorgan  路  3Comments

haoxins picture haoxins  路  4Comments