Bugfixing
This commit is contained in:
+5
-5
@@ -20,12 +20,12 @@ export default boot(({store}) => {
|
|||||||
config.headers['Authorization'] = `Bearer ${token}`
|
config.headers['Authorization'] = `Bearer ${token}`
|
||||||
}
|
}
|
||||||
|
|
||||||
if (['/refresh', '/login'].includes(config.url)) {
|
if (['/refresh', '/login'].includes(config.url)) {
|
||||||
delete config.headers['Authorization'];
|
delete config.headers['Authorization'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
})
|
})
|
||||||
|
|
||||||
// Response interceptor for API calls
|
// Response interceptor for API calls
|
||||||
api.interceptors.response.use(
|
api.interceptors.response.use(
|
||||||
|
|||||||
@@ -1,7 +1,17 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
|
const props = defineProps({
|
||||||
|
photos: {
|
||||||
|
type: Number,
|
||||||
|
required: false,
|
||||||
|
default: 9
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
gallery skeleton
|
<div class="row">
|
||||||
|
<div class="col-6 col-sm-4 col-md-4 col-lg-3 q-pa-sm" v-for="i in props.photos" :key="i">
|
||||||
|
<q-skeleton type="rect" width="100%" height="200px" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -37,7 +37,8 @@ import {useUserStore} from "stores/User";
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
preFetch() {
|
preFetch() {
|
||||||
return useUserStore().fetchLoggedUserDetail({refresh: true});
|
// todo: nevim proc tu nefunguje refresh, neposila se credentials
|
||||||
|
return useUserStore().fetchLoggedUserDetail({refresh: false});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,11 +1,20 @@
|
|||||||
|
<script>
|
||||||
|
import {useAircraftsStore} from "stores/Aircrafts";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
preFetch({currentRoute}) {
|
||||||
|
return useAircraftsStore().fetchPublicDetail(currentRoute.params.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
<script setup>
|
<script setup>
|
||||||
import {useRoute, useRouter} from "vue-router";
|
import {useRouter} from "vue-router";
|
||||||
import {useMeta, useQuasar} from "quasar";
|
import {useMeta, useQuasar} from "quasar";
|
||||||
import AircraftDetailSkeleton from "components/aircrafts/skeletons/AircraftDetailSkeleton.vue";
|
import AircraftDetailSkeleton from "components/aircrafts/skeletons/AircraftDetailSkeleton.vue";
|
||||||
import {useAppStore} from "stores/App";
|
import {useAppStore} from "stores/App";
|
||||||
import FlightsList from "components/flights/FlightsList.vue";
|
import FlightsList from "components/flights/FlightsList.vue";
|
||||||
import {storeToRefs} from "pinia";
|
import {storeToRefs} from "pinia";
|
||||||
import {onMounted, onServerPrefetch} from "vue";
|
import {onMounted} from "vue";
|
||||||
import {metaData} from "src/composables/meta";
|
import {metaData} from "src/composables/meta";
|
||||||
import PhotoGallery from "components/photos/PhotoGallery.vue";
|
import PhotoGallery from "components/photos/PhotoGallery.vue";
|
||||||
import ContentCard from "components/ContentCard.vue";
|
import ContentCard from "components/ContentCard.vue";
|
||||||
@@ -15,16 +24,10 @@ import {usePhotosStore} from "stores/Photos";
|
|||||||
import {useFlightsStore} from "stores/Flights";
|
import {useFlightsStore} from "stores/Flights";
|
||||||
import FlightsListSkeleton from "components/flights/skeletons/FlightsListSkeleton.vue";
|
import FlightsListSkeleton from "components/flights/skeletons/FlightsListSkeleton.vue";
|
||||||
import BasicInfoBanner from "components/banners/BasicInfoBanner.vue";
|
import BasicInfoBanner from "components/banners/BasicInfoBanner.vue";
|
||||||
import {useAircraftsStore} from "stores/Aircrafts";
|
|
||||||
import PhotoGallerySkeleton from "components/photos/skeletons/PhotoGallerySkeleton.vue";
|
import PhotoGallerySkeleton from "components/photos/skeletons/PhotoGallerySkeleton.vue";
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const $router = useRouter();
|
const $router = useRouter();
|
||||||
const $route = useRoute();
|
|
||||||
|
|
||||||
onServerPrefetch(() => {
|
|
||||||
return useAircraftsStore().fetchPublicDetail($route.params.id);
|
|
||||||
});
|
|
||||||
|
|
||||||
const loggedUser = storeToRefs(useUserStore()).user;
|
const loggedUser = storeToRefs(useUserStore()).user;
|
||||||
const {aircraft, isQueryRunning} = storeToRefs(useAircraftsStore());
|
const {aircraft, isQueryRunning} = storeToRefs(useAircraftsStore());
|
||||||
|
|||||||
@@ -1,3 +1,13 @@
|
|||||||
|
<script>
|
||||||
|
import {usePointsOfInterestStore} from "stores/PointsOfInterest";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
preFetch({currentRoute}) {
|
||||||
|
return usePointsOfInterestStore().fetchPublicDetail(currentRoute.params.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import {storeToRefs} from "pinia";
|
import {storeToRefs} from "pinia";
|
||||||
import {usePhotosStore} from "stores/Photos";
|
import {usePhotosStore} from "stores/Photos";
|
||||||
@@ -11,23 +21,13 @@ import {useMeta} from "quasar";
|
|||||||
import {metaData} from "src/composables/meta";
|
import {metaData} from "src/composables/meta";
|
||||||
import FlightsListSkeleton from "components/flights/skeletons/FlightsListSkeleton.vue";
|
import FlightsListSkeleton from "components/flights/skeletons/FlightsListSkeleton.vue";
|
||||||
import BasicInfoBanner from "components/banners/BasicInfoBanner.vue";
|
import BasicInfoBanner from "components/banners/BasicInfoBanner.vue";
|
||||||
import {usePointsOfInterestStore} from "stores/PointsOfInterest";
|
import {onMounted} from "vue";
|
||||||
import {onServerPrefetch} from "vue";
|
import PhotoGallerySkeleton from "components/photos/skeletons/PhotoGallerySkeleton.vue";
|
||||||
import {useRoute} from "vue-router";
|
|
||||||
|
|
||||||
const $route = useRoute();
|
|
||||||
|
|
||||||
onServerPrefetch(() => {
|
|
||||||
return usePointsOfInterestStore().fetchPublicDetail($route.params.id);
|
|
||||||
});
|
|
||||||
|
|
||||||
const {pointOfInterest, isQueryRunning} = storeToRefs(usePointsOfInterestStore());
|
const {pointOfInterest, isQueryRunning} = storeToRefs(usePointsOfInterestStore());
|
||||||
const {photos, isQueryRunning: arePhotosLoading} = storeToRefs(usePhotosStore());
|
const {photos, isQueryRunning: arePhotosLoading} = storeToRefs(usePhotosStore());
|
||||||
const {flights, isQueryRunning: areFlightsLoading} = storeToRefs(useFlightsStore());
|
const {flights, isQueryRunning: areFlightsLoading} = storeToRefs(useFlightsStore());
|
||||||
|
|
||||||
usePhotosStore().fetchPublic({pointOfInterestId: pointOfInterest.value.id});
|
|
||||||
useFlightsStore().fetchPublic({pointOfInterestId: pointOfInterest.value.id});
|
|
||||||
|
|
||||||
useAppStore().setPageTitle(pointOfInterest.value.name);
|
useAppStore().setPageTitle(pointOfInterest.value.name);
|
||||||
useMeta(() => metaData({
|
useMeta(() => metaData({
|
||||||
title: pointOfInterest.value.name,
|
title: pointOfInterest.value.name,
|
||||||
@@ -38,6 +38,12 @@ useAppStore().setBreadcrumbs([
|
|||||||
{to: {name: 'homepage'}, label: "Polétání.cz"},
|
{to: {name: 'homepage'}, label: "Polétání.cz"},
|
||||||
{label: pointOfInterest.value.name}
|
{label: pointOfInterest.value.name}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
usePhotosStore().fetchPublic({pointOfInterestId: pointOfInterest.value.id});
|
||||||
|
useFlightsStore().fetchPublic({pointOfInterestId: pointOfInterest.value.id});
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -54,7 +60,8 @@ useAppStore().setBreadcrumbs([
|
|||||||
:zoom="13"
|
:zoom="13"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<PhotoGallery :photos="photos" class="q-my-lg"/>
|
<PhotoGallerySkeleton v-if="arePhotosLoading && !pointOfInterest" />
|
||||||
|
<PhotoGallery :photos="photos" class="q-my-lg" v-else />
|
||||||
|
|
||||||
<h3>Lety na místo {{ pointOfInterest.name }}</h3>
|
<h3>Lety na místo {{ pointOfInterest.name }}</h3>
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export const useAircraftsStore = defineStore('Aircrafts', () => {
|
|||||||
const fetchPublicDetail = (id) => query({
|
const fetchPublicDetail = (id) => query({
|
||||||
isQueryRunning,
|
isQueryRunning,
|
||||||
query: AIRCRAFT_PUBLIC_DETAIL,
|
query: AIRCRAFT_PUBLIC_DETAIL,
|
||||||
variables: {id, public: true},
|
variables: {id},
|
||||||
}).then(item => {
|
}).then(item => {
|
||||||
aircraft.value = item;
|
aircraft.value = item;
|
||||||
return item;
|
return item;
|
||||||
|
|||||||
+1
-3
@@ -66,9 +66,7 @@ export const useUserStore = defineStore('LoggedUser', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const setTokens = ({access_token, access_token_validity}) => {
|
const setTokens = ({access_token, access_token_validity}) => {
|
||||||
const now = new Date().getTime() / 1000;
|
cookies.set("accessToken", access_token, {expires: `${access_token_validity}s`})
|
||||||
// TODO: asi nefunguje expirace
|
|
||||||
cookies.set("accessToken", access_token, {expires: now + access_token_validity})
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getAccessToken = () => {
|
const getAccessToken = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user