in public/js/account.js [92:113]
async unsubscribeFromShow(show) {
/*
The endpoint delete-entitlements requires a list of the entitlements(s) that should be removed from the user.
For detailed information: https://developer.spotify.com/documentation/open-access/reference/#/operations/delete-entitlements
*/
if (this.model.isLinked) {
await fetch("/api/user-spotify-delete-entitlements", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ entitlements: [show] }),
});
} else {
await fetch("/api/update-subscription", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
entitlements: this.model.subscriptions.filter((s) => s !== show),
}),
});
}
this.model.syncSubscriptions();
}