Skip to content

Commit

Permalink
fix(vuex): use await on actions that return a value
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroAkbal committed Oct 19, 2020
1 parent ee5edf5 commit 16489a4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions store/booru/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ export const actions = {
},

async fetchPosts({ dispatch }, mode) {
const url = dispatch('createAPIURL', { mode: 'posts' })
const url = await dispatch('createAPIURL', { mode: 'posts' }) // Tip: Actions that return a value have to be awaited

try {
const response = await dispatch(
Expand Down Expand Up @@ -309,7 +309,7 @@ export const actions = {
},

async fetchSearchTag({ dispatch, commit }, tag) {
const url = dispatch('createAPIURL', { mode: 'tags', tag })
const url = await dispatch('createAPIURL', { mode: 'tags', tag })

try {
const response = await dispatch(
Expand Down

0 comments on commit 16489a4

Please sign in to comment.