ptitlutins/app/pages/voyages/[id].vue
2025-09-28 04:25:01 +02:00

23 lines
598 B
Vue

<template>
<Voyage
:voyage="voyagesLinksStore.currentVoyageLink?.voyage"
:voyageData="voyageStore.getVoyageData"
/>
</template>
<script setup lang="ts">
const route = useRoute()
const voyagesLinksStore = useVoyagesLinksStore()
const voyageStore = useVoyageStore()
// When accessing /posts/1, route.params.id will be 1
const linkId = route.params.id as string
if (
voyagesLinksStore.currentVoyageLink?.id &&
voyagesLinksStore.currentVoyageLink.id == linkId
) {
// nothing to fetch, already in the store
} else {
await voyagesLinksStore.setCurrentVoyageLink(linkId)
}
</script>