Skip to content
This repository has been archived by the owner on Dec 17, 2024. It is now read-only.

Commit

Permalink
feat: open in spotify
Browse files Browse the repository at this point in the history
  • Loading branch information
Schlauer-Hax committed Sep 25, 2024
1 parent ae2c639 commit 85b33f2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pages/music/edit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,17 @@ sheetStack.setDefault(Vertical(
},
}
: Empty(),
drop.type === "PUBLISHED"
? {
id: "spotify",
title: "Spotify",
subtitle: "Open your Drop on Spotify",
clickHandler: async () => {
const url = await API.music.id(drop._id).spotify().then(stupidErrorAlert);
globalThis.open(url.spotify, "_blank");
},
}
: Empty(),
],
})
.addClass(
Expand Down
6 changes: 6 additions & 0 deletions pages/shared/restSpec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,12 @@ export const API = {
})
.then(blob())
.catch(reject),
spotify: () =>
fetch(`${API.BASE_URL}music/${id}/spotify`, {
headers: headers(API.getToken()),
})
.then(json<{ spotify: string }>())
.catch(reject),
}),
}),
};
Expand Down

0 comments on commit 85b33f2

Please sign in to comment.