%PDF- %PDF-
Direktori : /home/forge/takeaseat.eco-n-tech.co.uk/store/ |
Current File : //home/forge/takeaseat.eco-n-tech.co.uk/store/location.js |
export const state = () => ({ location: null, therapists: [], meta: [], }) export const mutations = { setLocation(state, data) { state.location = data }, setList(state, data) { state.therapists = data }, setMeta(state, data) { state.meta = data }, } export const actions = { async get({ commit, dispatch }, payload) { await this.$axios.get('/location/'+payload) .then((res) => { if (res.status === 200) { commit('setLocation', res.data) dispatch('getTherapists', { locationData: { lat: res.data.lat, lng: res.data.lng }, distance: 30 }) } }) }, async getTherapists({ commit, error }, payload) { await this.$axios.post('/therapists', payload).then((res) => { if (res.status === 200) { commit('setList', res.data.data) commit('setMeta', res.data.meta) } }) }, }