Prace s mapou, refresh tokenu (tak nejak), uprava vypisu POI, pridani breadcrumbs
This commit is contained in:
+6
-23
@@ -1,7 +1,6 @@
|
||||
import { route } from 'quasar/wrappers'
|
||||
import { createRouter, createMemoryHistory, createWebHistory, createWebHashHistory } from 'vue-router'
|
||||
import {route} from 'quasar/wrappers'
|
||||
import {createRouter, createMemoryHistory, createWebHistory, createWebHashHistory} from 'vue-router'
|
||||
import routes from './routes'
|
||||
import {useUserStore} from "stores/User";
|
||||
import {useAppStore} from "stores/App";
|
||||
|
||||
/*
|
||||
@@ -19,7 +18,7 @@ export default route(function (/* { store, ssrContext } */) {
|
||||
: (process.env.VUE_ROUTER_MODE === 'history' ? createWebHistory : createWebHashHistory)
|
||||
|
||||
const Router = createRouter({
|
||||
scrollBehavior: () => ({ left: 0, top: 0 }),
|
||||
scrollBehavior: () => ({left: 0, top: 0}),
|
||||
routes,
|
||||
|
||||
// Leave this as is and make changes in quasar.conf.js instead!
|
||||
@@ -28,25 +27,9 @@ export default route(function (/* { store, ssrContext } */) {
|
||||
history: createHistory(process.env.VUE_ROUTER_BASE)
|
||||
})
|
||||
|
||||
Router.beforeEach(async (to) => {
|
||||
if (to.meta?.protected) {
|
||||
const userStore = useUserStore();
|
||||
// const $q = useQuasar();
|
||||
|
||||
useAppStore().resetAfterRouteChange();
|
||||
|
||||
userStore.setupCredentials().then(()=>{
|
||||
if (!userStore.user.id) {
|
||||
// console.log("neni prihlaseny")
|
||||
// $q.notify("No access token, login again!");
|
||||
Router.push({name: "login"});
|
||||
}
|
||||
}).catch(e => {
|
||||
// console.error("Error in router: ", e);
|
||||
});
|
||||
|
||||
}
|
||||
})
|
||||
Router.afterEach(async (to) => {
|
||||
useAppStore().resetAfterRouteChange();
|
||||
});
|
||||
|
||||
return Router
|
||||
})
|
||||
|
||||
@@ -25,10 +25,10 @@ const routes = [
|
||||
{path: 'poi/add', name: "addPOI", component: () => import('pages/profile/forms/NewPointOfInterestPage.vue')},
|
||||
{path: 'poi/:id', name: "poiDetail", component: () => import('pages/profile/details/PointOfInterestDetailPage.vue')},
|
||||
{path: 'poi/:id/edit', name: "poiEdit", component: () => import('pages/profile/forms/EditPointOfInterestPage.vue')},
|
||||
{path: 'pilots', name: "pilots", component: () => import('pages/profile/lists/SecondPilotPage.vue')},
|
||||
{path: 'pilots', name: "pilots", component: () => import('pages/profile/lists/CopilotsPage.vue')},
|
||||
{path: 'pilots/add', name: "addPilots", component: () => import('pages/profile/forms/NewCopilotPage.vue')},
|
||||
{path: 'pilots/:id', name: "pilotDetail", component: () => import('pages/profile/details/CopilotDetailPage.vue')},
|
||||
{path: 'pilots/:id/edit', name: "pilotEdit", component: () => import('pages/profile/details/EditCopilotPage.vue')},
|
||||
{path: 'pilots/:id/edit', name: "pilotEdit", component: () => import('pages/profile/forms/EditCopilotPage.vue')},
|
||||
{path: 'aircrafts', name: "aircrafts", component: () => import('pages/profile/lists/AircraftsPage.vue')},
|
||||
{path: 'aircrafts/new', name: "addAircraft", component: () => import('pages/profile/forms/NewAircraftsPage.vue')},
|
||||
{path: 'aircrafts/:id', name: "aircraftDetail", component: () => import('pages/profile/details/AircraftDetailPage.vue')},
|
||||
|
||||
Reference in New Issue
Block a user