{BUGFIX} Suppression d'un album depuis la liste

This commit is contained in:
Damien Broqua 2023-09-22 08:46:43 +02:00
parent 4ea7b42d52
commit e28f382c6c
2 changed files with 13 additions and 14 deletions

View File

@ -167,10 +167,11 @@ Vue.createApp({
this.toggleModal(); this.toggleModal();
}, },
deleteItem() { deleteItem() {
if ( vueType === 'private' ) { // eslint-disable-next-line no-undef
if (vueType !== "private") {
return false; return false;
} }
axios return axios
.delete(`/api/v1/albums/${this.itemId}`) .delete(`/api/v1/albums/${this.itemId}`)
.then(() => { .then(() => {
this.fetch(); this.fetch();
@ -186,10 +187,11 @@ Vue.createApp({
}); });
}, },
shareCollection() { shareCollection() {
if ( vueType === 'private' ) { // eslint-disable-next-line no-undef
if (vueType !== "private") {
return false; return false;
} }
axios return axios
.patch(`/api/v1/me`, { .patch(`/api/v1/me`, {
isPublicCollection: !this.isPublicCollection, isPublicCollection: !this.isPublicCollection,
}) })
@ -219,19 +221,16 @@ Vue.createApp({
}); });
}, },
renderAlbumTitle(item) { renderAlbumTitle(item) {
let render = ''; let render = "";
for ( let i = 0 ; i < item.artists.length ; i += 1 ) { for (let i = 0; i < item.artists.length; i += 1) {
const { const { name, join } = item.artists[i];
name, render += `${name} ${join ? `${join} ` : ""}`;
join,
} = item.artists[i];
render += `${name} ${join ? `${join} ` : ''}`;
} }
render += `- ${item.title}`; render += `- ${item.title}`;
return render; return render;
} },
}, },
}).mount("#collection"); }).mount("#collection");

View File

@ -297,7 +297,7 @@ Publié automatiquement via #musictopus`;
*/ */
async deleteOne() { async deleteOne() {
const res = await AlbumsModel.findOneAndDelete({ const res = await AlbumsModel.findOneAndDelete({
user: this.req.user._id, User: this.req.user._id,
_id: this.req.params.itemId, _id: this.req.params.itemId,
}); });