Skip to content

Commit

Permalink
check if playlist is owned by current user
Browse files Browse the repository at this point in the history
  • Loading branch information
daronenko committed Dec 20, 2024
1 parent a68ec46 commit c023550
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/widgets/playlistCard/ui/playlistCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,16 @@ export class PlaylistCardView {
this.subscribeBtn.classList.add(styles["playlist__liked"]);
}

this.imageUploaderView = new ImageUploaderView({
parent: document.querySelector(".image_uploader"),
uploadFunction: (formData) =>
playlistAPI.updateImage(playlist.id, formData),
onSuccessEvent: 'updatePlaylistImageSuccess',
navigateUrl: `/playlist/${playlist.id}`,
});
await this.imageUploaderView.render();
if (this.isMyPlaylist) {
this.imageUploaderView = new ImageUploaderView({
parent: document.querySelector(".image_uploader"),
uploadFunction: (formData) =>
playlistAPI.updateImage(playlist.id, formData),
onSuccessEvent: 'updatePlaylistImageSuccess',
navigateUrl: `/playlist/${playlist.id}`,
});
await this.imageUploaderView.render();
}
}

async getElements() {
Expand Down

0 comments on commit c023550

Please sign in to comment.