Ne uplne otestovany prepis storu
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
<script setup>
|
||||
import {useRoute} from "vue-router";
|
||||
import {copilot, fetchCopilot, loading as copilotLoading} from "src/composables/objects/copilot";
|
||||
import {fetchUser, user as pilot, loading as pilotLoading} from "src/composables/objects/user";
|
||||
import {onMounted} from "vue";
|
||||
import FlightsList from "components/flights/FlightsList.vue";
|
||||
import {useAppStore} from "stores/App";
|
||||
import BasicListSkeleton from "components/basicSkeletons/BasicListSkeleton.vue";
|
||||
import {useUserStore} from "stores/User";
|
||||
import {useCopilotsStore} from "stores/Copilots";
|
||||
import {storeToRefs} from "pinia";
|
||||
|
||||
const $route = useRoute();
|
||||
const copilotId = parseInt($route.params.id);
|
||||
@@ -22,17 +23,19 @@ const props = defineProps({
|
||||
}
|
||||
});
|
||||
|
||||
const {copilot, isQueryRunning} = storeToRefs(useCopilotsStore());
|
||||
const {publicUser, isQueryRunning: isPilotQueryRunning} = storeToRefs(useUserStore());
|
||||
|
||||
onMounted(() => {
|
||||
Promise.all([
|
||||
fetchUser(props.username),
|
||||
fetchCopilot(copilotId, props.username)
|
||||
useUserStore().fetchPublicUserDetail(props.username),
|
||||
useCopilotsStore().fetchDetail(copilotId, props.username)
|
||||
]).then(() => {
|
||||
useAppStore().setPageTitle(`${pilot.value.name} + ${copilot.value.name}`);
|
||||
useAppStore().setPageTitle(`${publicUser.value.name} + ${copilot.value.name}`);
|
||||
useAppStore().setBreadcrumbs([
|
||||
{to: {name: 'homepage'}, label: "Polétání.cz"},
|
||||
{to: {name: "publicProfileDetail", params: {username: props.username}}, label: `@${props.username}`},
|
||||
{label: pilot.value.name}
|
||||
{label: publicUser.value.name}
|
||||
]);
|
||||
});
|
||||
});
|
||||
@@ -40,7 +43,7 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<BasicListSkeleton v-if="copilotLoading || pilotLoading" class="q-mb-md"/>
|
||||
<BasicListSkeleton v-if="isQueryRunning || isPilotQueryRunning || !copilot" class="q-mb-md"/>
|
||||
|
||||
<template v-else>
|
||||
<h3>Společné lety</h3>
|
||||
|
||||
Reference in New Issue
Block a user