From a6fab92165e19641acea07638b66c15e86c91494 Mon Sep 17 00:00:00 2001 From: Thomas Amland Date: Sat, 15 Aug 2020 09:35:51 +0200 Subject: [PATCH] add star album --- src/library/album/AlbumDetails.vue | 12 ++++++++++++ src/shared/api.ts | 8 ++++++++ src/shared/components/Icon.vue | 2 ++ 3 files changed, 22 insertions(+) diff --git a/src/library/album/AlbumDetails.vue b/src/library/album/AlbumDetails.vue index 15d93c2..7e7e6cd 100644 --- a/src/library/album/AlbumDetails.vue +++ b/src/library/album/AlbumDetails.vue @@ -18,6 +18,9 @@ Play + + + @@ -62,6 +65,15 @@ }) } }, + toggleStar() { + if (this.album) { + const value = !this.album.starred + this.album.starred = value + return value + ? this.$api.starAlbum(this.album.id) + : this.$api.unstarAlbum(this.album.id) + } + } } }) diff --git a/src/shared/api.ts b/src/shared/api.ts index 2fd8dfa..0f580db 100644 --- a/src/shared/api.ts +++ b/src/shared/api.ts @@ -215,6 +215,14 @@ export class API { } } + starAlbum(id: string) { + return this.star('album', id) + } + + unstarAlbum(id: string) { + return this.unstar('album', id) + } + async star(type: 'track' | 'album' | 'artist', id: string) { const params = { id: type === 'track' ? id : undefined, diff --git a/src/shared/components/Icon.vue b/src/shared/components/Icon.vue index 5231b2c..9c29ff9 100644 --- a/src/shared/components/Icon.vue +++ b/src/shared/components/Icon.vue @@ -7,6 +7,7 @@ BIcon, BIconCardText, BIconMusicNoteList, + BIconStar, BIconStarFill, BIconCollectionFill, BIconList, @@ -27,6 +28,7 @@ BIcon, BIconCardText, BIconMusicNoteList, + BIconStar, BIconStarFill, BIconCollectionFill, BIconList,