export const state = () => ({ location: {} }); export const mutations = { setlocation: (state, location) => { state.location = location; } }; export const actions = { async getLocation({ commit }, { id, callback = false }) { try { const location = await this.$axios.$get(`/api/locations/${id}`); if (callback) return location; commit("setLocation", location); } catch (e) { throw Error("API Error occurred."); } } }; export const getters = { location: state => state.location };