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

14
store/wishes.js

@ -41,13 +41,23 @@ export const actions = {
deleteWish({ commit, state }, wishid) {
return this.$axios.$delete(BASE_API_URL + '/wishes/' + wishid, getAxiosConfig(localStorage.getItem("token"))).then(() => {
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) {
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))
await this.dispatch('wishes/fetchPublic')
await this.dispatch('wishes/fetchClaimed')
await this.dispatch('fetchClaimed', state)
})
},
}

Loading…
Cancel
Save