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;
};
+8 -6
View File
@@ -2,22 +2,24 @@
<div class="not-found-view">
<h1>404</h1>
<p>Page not found</p>
<RouterLink to="/" class="button primary">
<RouterLink to="/" class="fancy-button">
Home
</RouterLink>
</div>
</template>
<script setup lang="ts">
</script>
<style scoped>
<style scoped lang="scss">
.not-found-view {
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
h1 {
font-size: 20vh;
line-height: 100%;
margin: 10px;
}
}
</style>