feat: dev token loading, basic setup for musickit

This commit is contained in:
2026-08-23 09:28:19 +02:00
parent d03fbe5e66
commit c38b8d3115
7 changed files with 174 additions and 37 deletions
+20 -2
View File
@@ -1,5 +1,23 @@
export const useMusicKit = () => {
const init = () => {
export const useMusicKit = ( storefront: string = 'ch' ) => {
const init = async () => {
const res = await fetch( import.meta.env.VITE_BACKEND_URL + '/', {
'credentials': 'include'
} );
if ( res.status === 200 ) {
const token = await res.text();
window.MusicKit.configure( {
'developerToken': token,
'app': {
'name': 'MusicPlayer',
'build': '4',
'icon': 'https://music.janishutz.com/logo.jpg'
},
'storefront': storefront.toUpperCase()
} );
}
isInit = true;
};