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

fnlctrl picture fnlctrl  路  4Comments

visualjerk picture visualjerk  路  3Comments

niallobrien picture niallobrien  路  3Comments

jskrzypek picture jskrzypek  路  3Comments

Ge-yuan-jun picture Ge-yuan-jun  路  3Comments