@93 - Wantlist

This commit is contained in:
Damien Broqua 2024-06-15 10:13:22 +02:00
parent bed5139a27
commit a4a3933c6d
24 changed files with 1137 additions and 70 deletions

View file

@ -1,3 +1,4 @@
/* eslint-disable no-undef */
if (typeof item !== "undefined") {
Vue.createApp({
data() {
@ -196,7 +197,7 @@ if (typeof item !== "undefined") {
updateItem() {
showToastr("Mise à jour en cours…", true);
axios
.patch(`/api/v1/albums/${this.item._id}`)
.patch(`/api/v1/${action}/${this.item._id}`)
.then((res) => {
showToastr("Mise à jour réalisée avec succès", true);
this.item = res.data;
@ -215,9 +216,12 @@ if (typeof item !== "undefined") {
},
deleteItem() {
axios
.delete(`/api/v1/albums/${this.item._id}`)
.delete(`/api/v1/${action}/${this.item._id}`)
.then(() => {
window.location.href = "/ma-collection";
window.location.href =
action === "albums"
? "/ma-collection"
: "/ma-liste-de-souhaits";
})
.catch((err) => {
showToastr(
@ -238,7 +242,7 @@ if (typeof item !== "undefined") {
}
this.shareSubmiting = true;
axios
.post(`/api/v1/albums/${this.item._id}/share`, {
.post(`/api/v1/${action}/${this.item._id}/share`, {
message: this.shareMessageTransformed,
})
.then(() => {