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

View file

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