another ratings fix

This commit is contained in:
booploops 2022-01-05 07:57:25 -08:00
parent 9a7404c950
commit fbcfb07937

View file

@ -2592,10 +2592,11 @@ const app = new Vue({
async getRating(item) { async getRating(item) {
let type = item.type.slice(-1) === "s" ? item.type : item.type + "s" let type = item.type.slice(-1) === "s" ? item.type : item.type + "s"
let id = item.attributes.playParams.catalogId ? item.attributes.playParams.catalogId : item.id let id = item.attributes.playParams.catalogId ? item.attributes.playParams.catalogId : item.id
if (id.startsWith("i.")) { if (item.id.startsWith("i.")) {
if(!type.startsWith("library-")) { if(!type.startsWith("library-")) {
type = "library-" + type type = "library-" + type
} }
id = item.id
} }
let response = await this.mk.api.v3.music(`/v1/me/ratings/${type}?platform=web&ids=${id}`) let response = await this.mk.api.v3.music(`/v1/me/ratings/${type}?platform=web&ids=${id}`)
if(response.data.data.length != 0) { if(response.data.data.length != 0) {
@ -2608,10 +2609,11 @@ const app = new Vue({
love(item) { love(item) {
let type = item.type.slice(-1) === "s" ? item.type : item.type + "s" let type = item.type.slice(-1) === "s" ? item.type : item.type + "s"
let id = item.attributes.playParams.catalogId ? item.attributes.playParams.catalogId : item.id let id = item.attributes.playParams.catalogId ? item.attributes.playParams.catalogId : item.id
if (id.startsWith("i.")) { if (item.id.startsWith("i.")) {
if(!type.startsWith("library-")) { if(!type.startsWith("library-")) {
type = "library-" + type type = "library-" + type
} }
id = item.id
} }
this.mk.api.v3.music(`/v1/me/ratings/${type}/${id}`, {}, { this.mk.api.v3.music(`/v1/me/ratings/${type}/${id}`, {}, {
fetchOptions: fetchOptions:
@ -2631,10 +2633,11 @@ const app = new Vue({
dislike(item) { dislike(item) {
let type = item.type.slice(-1) === "s" ? item.type : item.type + "s" let type = item.type.slice(-1) === "s" ? item.type : item.type + "s"
let id = item.attributes.playParams.catalogId ? item.attributes.playParams.catalogId : item.id let id = item.attributes.playParams.catalogId ? item.attributes.playParams.catalogId : item.id
if (id.startsWith("i.")) { if (item.id.startsWith("i.")) {
if(!type.startsWith("library-")) { if(!type.startsWith("library-")) {
type = "library-" + type type = "library-" + type
} }
id = item.id
} }
this.mk.api.v3.music(`/v1/me/ratings/${type}/${id}`, {}, { this.mk.api.v3.music(`/v1/me/ratings/${type}/${id}`, {}, {
fetchOptions: fetchOptions:
@ -2654,10 +2657,11 @@ const app = new Vue({
unlove(item) { unlove(item) {
let type = item.type.slice(-1) === "s" ? item.type : item.type + "s" let type = item.type.slice(-1) === "s" ? item.type : item.type + "s"
let id = item.attributes.playParams.catalogId ? item.attributes.playParams.catalogId : item.id let id = item.attributes.playParams.catalogId ? item.attributes.playParams.catalogId : item.id
if (id.startsWith("i.")) { if (item.id.startsWith("i.")) {
if(!type.startsWith("library-")) { if(!type.startsWith("library-")) {
type = "library-" + type type = "library-" + type
} }
id = item.id
} }
this.mk.api.v3.music(`/v1/me/ratings/${type}/${id}`, {}, { this.mk.api.v3.music(`/v1/me/ratings/${type}/${id}`, {}, {
fetchOptions: fetchOptions: