Browse Source

Version 1.1

master
PrivateGER 3 years ago
parent
commit
e972e79df4
Signed by: PrivateGER GPG Key ID: CAE625C962F94C67
  1. 8
      components/publicwishlist.vue
  2. 14
      store/wishes.js

8
components/publicwishlist.vue

@ -39,17 +39,17 @@ export default {
return wish.owner_id === id; return wish.owner_id === id;
}); });
}, },
claimWish(id) { async claimWish(id) {
let response = this.$swal({ let response = await this.$swal({
title: 'Wunsch reservieren?', title: 'Wunsch reservieren?',
html: 'Du kannst Wünsche <b>NICHT</b> wieder freigeben!<br />Bitte sei dir sicher <b>bevor</b> du reservierst!', html: 'Du kannst Wünsche <b>NICHT</b> wieder freigeben!<br />Bitte sei dir sicher <b>bevor</b> du reservierst!',
type: 'warning', type: 'warning',
showCancelButton: true, showCancelButton: true,
cancelButtonText: "Abbrechen", cancelButtonText: "Abbrechen",
confirmButtonText: 'Reservieren', confirmButtonText: 'Reservieren',
}).value; });
if(!response) { if (!response.value) {
return; return;
} }

14
store/wishes.js

@ -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')
}) })
}, },
} }

Loading…
Cancel
Save