mirror of
https://github.com/janishutz/MusicPlayer.git
synced 2026-09-10 14:25:24 +02:00
feat: dev token loading, basic setup for musickit
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user