Cookies v SSR
This commit is contained in:
@@ -2,18 +2,17 @@
|
||||
import {useCopilotsStore} from "stores/Copilots";
|
||||
|
||||
export default {
|
||||
preFetch({store, currentRoute}) {
|
||||
return useCopilotsStore(store).fetchPublicDetail(currentRoute.params.id, currentRoute.params.username);
|
||||
preFetch({currentRoute}) {
|
||||
return useCopilotsStore().fetchPublicDetail(currentRoute.params.id, currentRoute.params.username);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<script setup>
|
||||
import FlightsList from "components/flights/FlightsList.vue";
|
||||
import {useAppStore} from "stores/App";
|
||||
import BasicListSkeleton from "components/basicSkeletons/BasicListSkeleton.vue";
|
||||
import {storeToRefs} from "pinia";
|
||||
import {onMounted} from "vue";
|
||||
import {onMounted, onServerPrefetch} from "vue";
|
||||
import {useFlightsStore} from "stores/Flights";
|
||||
import {usePhotosStore} from "stores/Photos";
|
||||
import FlightsListSkeleton from "components/flights/skeletons/FlightsListSkeleton.vue";
|
||||
@@ -21,13 +20,21 @@ import ContentCard from "components/ContentCard.vue";
|
||||
import PhotoGallery from "components/photos/PhotoGallery.vue";
|
||||
import {useMeta} from "quasar";
|
||||
import {metaData} from "src/composables/meta";
|
||||
// import {useCopilotsStore} from "stores/Copilots";
|
||||
// import {useRoute} from "vue-router";
|
||||
|
||||
const props = defineProps({
|
||||
pilot: {
|
||||
type: Object,
|
||||
required: false
|
||||
},
|
||||
});
|
||||
})
|
||||
|
||||
// const currentRoute = useRoute();
|
||||
//
|
||||
// onServerPrefetch(() => {
|
||||
//
|
||||
// })
|
||||
|
||||
const {copilot, isQueryRunning} = storeToRefs(useCopilotsStore());
|
||||
const {flights, isQueryRunning: areFlightsLoading} = storeToRefs(useFlightsStore());
|
||||
@@ -47,8 +54,10 @@ useMeta(() => metaData({
|
||||
image: copilot.value.titleImage?.url
|
||||
}));
|
||||
|
||||
useFlightsStore().fetchPublic({copilotId: copilot.value.id});
|
||||
usePhotosStore().fetchPublic({copilotId: copilot.value.id})
|
||||
onMounted(() => {
|
||||
useFlightsStore().fetchPublic({copilotId: copilot.value.id});
|
||||
usePhotosStore().fetchPublic({copilotId: copilot.value.id})
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -63,10 +72,10 @@ usePhotosStore().fetchPublic({copilotId: copilot.value.id})
|
||||
<h3>Společné lety</h3>
|
||||
<FlightsListSkeleton v-if="areFlightsLoading && flights.length === 0"/>
|
||||
<FlightsList
|
||||
v-else
|
||||
:items="flights"
|
||||
:public="true"
|
||||
class="q-mb-md"
|
||||
v-else
|
||||
:items="flights"
|
||||
:public="true"
|
||||
class="q-mb-md"
|
||||
/>
|
||||
</q-card-section>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user