async unsubscribeFromAllShows()

in public/js/account.js [115:136]


  async unsubscribeFromAllShows() {
    /*
    When calling the endpoint replace-entitlements with an empty list, all the user's entitlements will be removed.
    For detailed information: https://developer.spotify.com/documentation/open-access/reference/#/operations/replace-entitlements
    */
    if (this.model.isLinked) {
      await fetch("/api/user-spotify-replace-entitlements", {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({ entitlements: [] }),
      });
    } else {
      await fetch("/api/update-subscription", {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({
          entitlements: [],
        }),
      });
    }
    this.model.syncSubscriptions();
  }