check types on share

This commit is contained in:
booploops 2022-01-13 02:06:24 -08:00
parent 12be6212e8
commit 9a0b608b50

View file

@ -328,7 +328,25 @@
name: "Share", name: "Share",
icon: "./assets/feather/share.svg", icon: "./assets/feather/share.svg",
action: () => { action: () => {
app.mk.api.v3.music(`/v1/me/library/playlists/${this.data.id}/catalog`).then(res=>{ let route = ""
switch(this.data.type) {
case 'albums':
route = `/v1/catalog/us/albums/${this.data.id}`
break;
case 'playlists':
route = `/v1/catalog/us/playlists/${this.data.id}`
break;
case "library-playlists":
route = `/v1/me/library/playlists/${this.data.id}/catalog`
break
case "library-albums":
route = `/v1/me/library/albums/${this.data.id}/catalog`
break
}
if(route == '') {
return
}
app.mk.api.v3.music(route).then(res=>{
console.log(res.data.data[0].attributes.url) console.log(res.data.data[0].attributes.url)
app.copyToClipboard(res.data.data[0].attributes.url) app.copyToClipboard(res.data.data[0].attributes.url)
}) })