diff --git a/javascripts/collection.js b/javascripts/collection.js index 946ed7a..8397c3e 100644 --- a/javascripts/collection.js +++ b/javascripts/collection.js @@ -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"); \ No newline at end of file +}).mount("#collection"); diff --git a/src/middleware/Albums.js b/src/middleware/Albums.js index b234097..c152c4c 100644 --- a/src/middleware/Albums.js +++ b/src/middleware/Albums.js @@ -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, });