Files
evilspins/app/pages/box/[id].vue
valere 9771c799f2
All checks were successful
Deploy App / build (push) Successful in 2m20s
Deploy App / deploy (push) Successful in 14s
add default layout
2025-10-29 19:37:37 +01:00

36 lines
902 B
Vue

<template>
<boxes />
</template>
<script setup lang="ts">
import { onMounted } from 'vue'
import { useRoute } from 'vue-router'
import { useUiStore } from '~/store/ui'
import { useDataStore } from '~/store/data'
import { usePlayerStore } from '~/store/player'
// Configuration du layout
definePageMeta({
layout: 'default'
})
const uiStore = useUiStore()
const dataStore = useDataStore()
const route = useRoute()
onMounted(async () => {
await dataStore.loadData()
const idParam = Array.isArray(route.params.id) ? route.params.id[0] : route.params.id
if (typeof idParam === 'string' && idParam.length > 0) {
uiStore.selectBox(idParam)
// Lire automatiquement la box si on est sur la page d'une box
const box = dataStore.boxes.find(b => b.id === idParam)
if (box) {
const player = usePlayerStore()
player.playBox(box).catch(console.error)
}
}
})
</script>