import axios from "axios"; export const state = () => ({ menu: [] }); export const mutations = { SET_MENU(state, menu) { state.menu = menu; } }; export const actions = { async getMenu({ commit }) { await axios.get("https://api.amic.ru/api/v1/menu/list").then(res => { commit("SET_MENU", res.data.data) return true }) } }; export const getters = { menuHeader: s => s.menu.filter(link => link.type == 'header'), menuFooter: s => s.menu.filter(link => link.type == 'footer'), }; export default { namespaced: true, state, getters, actions, mutations }