Skip to content

Instantly share code, notes, and snippets.

@mercs600
Created April 6, 2020 17:04
Show Gist options
  • Save mercs600/0725377170e57ea5ad3debd19d2bf20c to your computer and use it in GitHub Desktop.
Save mercs600/0725377170e57ea5ad3debd19d2bf20c to your computer and use it in GitHub Desktop.
nuxt-exercise-6-errors
export const actions = {
async nuxtServerInit ({ commit }, { $http, error }) {
try {
const menu = await $http.$gest('api/menus')
commit('setMenu', menu)
} catch (err) {
return error(err)
}
}
}
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