Ne uplne otestovany prepis storu
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
<script setup>
|
||||
import {fetchFlights, flights, loading as flightsLoading} from "src/composables/objects/flight";
|
||||
import {fetchUser, user as pilot} from "src/composables/objects/user";
|
||||
import FlightsListSkeleton from "components/flights/FlightsListSkeleton.vue";
|
||||
import FlightsList from "components/flights/FlightsList.vue";
|
||||
import PublicFlightEventSwitcher from "components/navigation/PublicFlightEventSwitcher.vue";
|
||||
import {onMounted} from "vue";
|
||||
import {useAppStore} from "stores/App";
|
||||
import {useUserStore} from "stores/User";
|
||||
import {useFlightsStore} from "stores/Flights";
|
||||
import {storeToRefs} from "pinia";
|
||||
|
||||
const props = defineProps({
|
||||
loggedUser: {
|
||||
@@ -20,23 +21,27 @@ const props = defineProps({
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
fetchUser(props.username).then(user => {
|
||||
useUserStore().fetchPublicUserDetail(props.username).then(user => {
|
||||
useAppStore().setPageTitle(user.publicUsername);
|
||||
useAppStore().setBreadcrumbs([
|
||||
{to: {name: 'homepage'}, label: "Polétání.cz"},
|
||||
{label: `@${user.publicUsername}`},
|
||||
])
|
||||
})
|
||||
fetchFlights(props.username);
|
||||
})
|
||||
|
||||
useFlightsStore().fetch(props.username);
|
||||
});
|
||||
|
||||
const {flights, isQueryRunning: areFlightsLoading} = storeToRefs(useFlightsStore());
|
||||
const {publicUser: pilot} = storeToRefs(useUserStore());
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<PublicFlightEventSwitcher :username="username" />
|
||||
|
||||
<FlightsListSkeleton v-if="flightsLoading"/>
|
||||
<FlightsListSkeleton v-if="areFlightsLoading"/>
|
||||
|
||||
<q-banner class="bg-primary text-white" v-else-if="!flightsLoading && flights.length === 0">
|
||||
<q-banner class="bg-primary text-white" v-else-if="!areFlightsLoading && flights.length === 0">
|
||||
Tento pilot zatím nepublikoval žádný let.
|
||||
</q-banner>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user