Created
April 5, 2020 16:23
-
-
Save mercs600/610b0ce59d241f2004e9cb1a06500a79 to your computer and use it in GitHub Desktop.
nuxt-exercise-6-store-actions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const actions = { | |
async nuxtServerInit ({ commit }, { $http }) { | |
const menu = await $http.$get('api/menu') | |
commit('setMenu', menu) | |
} | |
} | |
export const state = () => ({ | |
menu: [] | |
}) | |
export const mutations = { | |
setMenu(state, payload) { | |
state.menu = payload | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment