added storefront for chip, added followArtistById added followingArtist to root
This commit is contained in:
parent
97e37149ae
commit
7a8cdf483b
2 changed files with 16 additions and 14 deletions
|
@ -1574,6 +1574,19 @@ const app = new Vue({
|
||||||
this.getArtistFromID(id)
|
this.getArtistFromID(id)
|
||||||
//this.getTypeFromID("artist",id,isLibrary,query)
|
//this.getTypeFromID("artist",id,isLibrary,query)
|
||||||
},
|
},
|
||||||
|
followArtistById(id, follow) {
|
||||||
|
if (follow && !this.followingArist(id)) {
|
||||||
|
this.cfg.home.followedArtists.push(id)
|
||||||
|
} else {
|
||||||
|
let index = this.cfg.home.followedArtists.indexOf(this.item.id)
|
||||||
|
if (index > -1) {
|
||||||
|
this.cfg.home.followedArtists.splice(index, 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
followingArtist(id) {
|
||||||
|
return this.cfg.home.followedArtists.includes(id)
|
||||||
|
},
|
||||||
playMediaItem(item) {
|
playMediaItem(item) {
|
||||||
let kind = (item.attributes.playParams ? (item.attributes.playParams.kind ?? (item.type ?? '')) : (item.type ?? ''));
|
let kind = (item.attributes.playParams ? (item.attributes.playParams.kind ?? (item.type ?? '')) : (item.type ?? ''));
|
||||||
let id = (item.attributes.playParams ? (item.attributes.playParams.id ?? (item.id ?? '')) : (item.id ?? ''));
|
let id = (item.attributes.playParams ? (item.attributes.playParams.id ?? (item.id ?? '')) : (item.id ?? ''));
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<div class="artist-chip__name">
|
<div class="artist-chip__name">
|
||||||
<span>{{ item.attributes.name }}</span>
|
<span>{{ item.attributes.name }}</span>
|
||||||
</div>
|
</div>
|
||||||
<button @click="followArtist" title="Follow" v-if="!$root.cfg.home.followedArtists.includes(item.id)" class="artist-chip__follow codicon codicon-add"></button>
|
<button @click="$root.followArtist(item.id, true)" title="Follow" v-if="!$root.followingArtist(item.id)" class="artist-chip__follow codicon codicon-add"></button>
|
||||||
<button @click="unfollowArtist" title="Following" v-else class="artist-chip__follow codicon codicon-check"></button>
|
<button @click="$root.followArtist(item.id, false)" title="Following" v-else class="artist-chip__follow codicon codicon-check"></button>
|
||||||
</div>
|
</div>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -26,24 +26,13 @@
|
||||||
},
|
},
|
||||||
template: '#artist-chip',
|
template: '#artist-chip',
|
||||||
async mounted() {
|
async mounted() {
|
||||||
app.mk.api.v3.music(`/v1/catalog/us/artists/${this.item.id}`).then(response => {
|
app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/artists/${this.item.id}`).then(response => {
|
||||||
this.artist = response.data.data[0];
|
this.artist = response.data.data[0];
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
route() {
|
route() {
|
||||||
app.appRoute(`artist/${this.item.id}`);
|
app.appRoute(`artist/${this.item.id}`);
|
||||||
},
|
|
||||||
followArtist () {
|
|
||||||
app.cfg.home.followedArtists.push(this.item.id)
|
|
||||||
notyf.success(`You are now following ${this.item.attributes.name}`)
|
|
||||||
},
|
|
||||||
unfollowArtist () {
|
|
||||||
let index = app.cfg.home.followedArtists.indexOf(this.item.id)
|
|
||||||
if (index > -1) {
|
|
||||||
app.cfg.home.followedArtists.splice(index, 1)
|
|
||||||
}
|
|
||||||
notyf.success(`You have unfollowed ${this.item.attributes.name}`)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue