|
@ -41,13 +41,23 @@ export const actions = { |
|
|
deleteWish({ commit, state }, wishid) { |
|
|
deleteWish({ commit, state }, wishid) { |
|
|
return this.$axios.$delete(BASE_API_URL + '/wishes/' + wishid, getAxiosConfig(localStorage.getItem("token"))).then(() => { |
|
|
return this.$axios.$delete(BASE_API_URL + '/wishes/' + wishid, getAxiosConfig(localStorage.getItem("token"))).then(() => { |
|
|
commit('setPersonal', state.personal.filter(w => w.id !== wishid)) |
|
|
commit('setPersonal', state.personal.filter(w => w.id !== wishid)) |
|
|
|
|
|
}).catch((err) => { |
|
|
|
|
|
this._vm.$swal({ |
|
|
|
|
|
text: err.response.data.toString(), |
|
|
|
|
|
type: 'error', |
|
|
|
|
|
showConfirmButton: false, |
|
|
|
|
|
timerProgressBar: true, |
|
|
|
|
|
timer: 3000, |
|
|
|
|
|
toast: true, |
|
|
|
|
|
position: 'bottom-center', |
|
|
|
|
|
iconColor: 'white' |
|
|
|
|
|
}) |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
claimWish({ commit, state }, wishid) { |
|
|
claimWish({ commit, state }, wishid) { |
|
|
return this.$axios.$post(BASE_API_URL + '/wishes/' + wishid + '/claim', {}, getAxiosConfig(localStorage.getItem("token"))).then(async () => { |
|
|
return this.$axios.$post(BASE_API_URL + '/wishes/' + wishid + '/claim', {}, getAxiosConfig(localStorage.getItem("token"))).then(async () => { |
|
|
commit('setPublic', state.public.filter(w => w.id !== wishid)) |
|
|
commit('setPublic', state.public.filter(w => w.id !== wishid)) |
|
|
await this.dispatch('wishes/fetchPublic') |
|
|
await this.dispatch('fetchClaimed', state) |
|
|
await this.dispatch('wishes/fetchClaimed') |
|
|
|
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
} |
|
|
} |
|
|