Directory Config for other project

This commit is contained in:
Paolo Arena
2019-05-02 16:58:36 +02:00
parent d924509d4f
commit 71ee9f6ae3
9 changed files with 22 additions and 313 deletions

View File

@@ -2,13 +2,14 @@ import Vue from 'vue'
import VueRouter, { RouterMode } from 'vue-router'
import { PositionResult } from 'vue-router/types/router'
import { IMyRoute, IMyRouteRecord, routesList } from './route-config'
import { IMyRoute, IMyRouteRecord } from './route-config'
import { ProgressBar } from '@src/store/Modules/Interface'
import { isEqual } from 'lodash'
import { UserStore } from '@store'
import { RouteNames } from '@src/router/route-names'
import { tools } from '@src/store/Modules/tools'
import { cfgrouter } from '../../cfg_locale'
Vue.use(VueRouter)
/*
* If not building with SSR mode, you can
@@ -17,7 +18,7 @@ Vue.use(VueRouter)
const Router = new VueRouter({
scrollBehavior: () => ({ x: 0, y: 0 } as PositionResult),
routes: routesList,
routes: cfgrouter.routes,
// Leave these as is and change from quasar.conf.js instead!
// quasar.conf.js -> build -> vueRouterMode
@@ -124,7 +125,7 @@ Router.beforeEach(async (to: IMyRoute, from: IMyRoute, next) => {
// next('/')
}
return Router.push({ name: RouteNames.login })
return Router.push({ name: 'login' })
}
} else if (to.matched.some((m) => m.meta.noAuth) && UserStore.state.isLogged) {
next('/')

View File

@@ -1,10 +1,9 @@
import { RouteConfig, Route, RouteRecord } from 'vue-router/types'
import { RouteNames } from './route-names'
import { tools } from '@src/store/Modules/tools'
import auth from '../middleware/auth'
import { Projects, Todos } from "@store"
import { Projects, Todos } from '@store'
interface IMyMeta {
title?: string,
@@ -33,154 +32,3 @@ export interface IMyRouteConfig extends RouteConfig {
children?: IMyRouteConfig[],
meta?: IMyMeta
}
export const routesList: IMyRouteConfig[] = [
{
path: '/',
name: RouteNames.home,
component: () => import('@/root/home/home.vue')
},
{
path: '/signup',
name: 'Registration',
component: () => import('@/views/login/signup/signup.vue')
},
{
path: '/signin',
name: RouteNames.login,
component: () => import('@/views/login/signin/signin.vue')
},
{
path: '/vreg',
name: 'Verify Reg',
component: () => import('@/views/login/vreg/vreg.vue')
},
{
path: '/todo/:category',
name: 'Todos',
component: () => import('@/views/todo-list/todo-list.vue'),
meta: {
requiresAuth: true,
async asyncData() {
await Todos.actions.dbLoad({ checkPending: false })
}
// middleware: [auth]
}
},
{
path: '/category',
name: 'category',
component: () => import('@/views/categories/category/category.vue')
},
{
path: '/admin/cfgserv',
name: 'cfgserv',
component: () => import('@/views/admin/cfgServer/cfgServer.vue'),
meta: {
requiresAuth: true
// middleware: [auth]
}
},
{
path: '/admin/testp1/:category',
name: 'Categories',
component: () => import('@/views/admin/testp1/testp1.vue')
},
{
path: '/offline',
name: 'Offline',
component: () => import('@/views/offline/offline.vue')
},
// {
// path: '/malaga',
// name: 'malaga',
// component: () => import('@/root/malaga/malaga.vue')
// },
{
path: '/' + RouteNames.projectsall + '/:idProj',
name: RouteNames.projectsall,
component: () => import('@/views/projects/proj-list/proj-list.vue'),
meta: {
requiresAuth: false,
async asyncData() {
await Projects.actions.dbLoad({ checkPending: false, onlyiffirsttime: true })
}
// middleware: [auth]
}
},
{
path: '/' + RouteNames.myprojects + '/:idProj',
name: RouteNames.myprojects,
component: () => import('@/views/projects/proj-list/proj-list.vue'),
meta: {
requiresAuth: true,
async asyncData() {
await Projects.actions.dbLoad({ checkPending: false, onlyiffirsttime: true })
}
// middleware: [auth]
}
},
{
path: '/' + RouteNames.projectsshared + '/:idProj',
name: RouteNames.projectsshared,
component: () => import('@/views/projects/proj-list/proj-list.vue'),
meta: {
requiresAuth: true,
async asyncData() {
await Projects.actions.dbLoad({ checkPending: false, onlyiffirsttime: true })
}
// middleware: [auth]
}
},
{
path: '/' + RouteNames.listprojects,
name: RouteNames.listprojects,
component: () => import('@/views/projects/proj-list/proj-list.vue'),
meta: {
requiresAuth: true,
async asyncData() {
await Projects.actions.dbLoad({ checkPending: false, onlyiffirsttime: true })
}
// middleware: [auth]
}
},
{
path: '/' + RouteNames.favouriteprojects,
name: RouteNames.favouriteprojects,
component: () => import('@/views/projects/proj-list/proj-list.vue'),
meta: {
requiresAuth: true,
async asyncData() {
await Projects.actions.dbLoad({ checkPending: false, onlyiffirsttime: true })
}
// middleware: [auth]
}
}
/*
{
path: '/requestresetpwd',
component: () => import('@/views/login/requestresetpwd.vue'),
meta: { nametranslate: 'Reset your Password' }
},
{
path: '/updatepwd',
component: () => import('@/views/login/updatepassword.vue'),
meta: { nametranslate: 'Update your Password' }
}
{
path: '/simpleform',
component: () => import('@/views/form/simpleForm/simpleForm.vue'),
meta: { nametranslate: 'SimpleForm' }
},
{
path: '/embeeded',
component: () => import('@/views/form/embeeded/embeeded.vue'),
meta: { nametranslate: 'Embeeded' }
}*/
]