diff --git a/src/App.vue b/src/App.vue index e0c499f..a1ef313 100644 --- a/src/App.vue +++ b/src/App.vue @@ -33,8 +33,9 @@ export default { ]), async created() { - this.$store.dispatch('getChannels'); - this.$store.dispatch('getVideos'); + this.$store.dispatch('getChannels').then(() => { + this.$store.dispatch('getVideos'); + }); }, }; diff --git a/src/store/actions.js b/src/store/actions.js index 476e312..9b477ba 100644 --- a/src/store/actions.js +++ b/src/store/actions.js @@ -13,7 +13,12 @@ export default { }, async getChannels({ commit }) { - commit(types.GET_CHANNELS, await database.channels.toArray()); + return new Promise((resolve) => { + database.channels.toArray().then((result) => { + commit(types.GET_CHANNELS, result); + resolve(); + }); + }); }, selectChannel({ commit, dispatch }, index) {