stash
This commit is contained in:
parent
17bfb84a94
commit
2fe8d14c2c
35 changed files with 1976 additions and 2134 deletions
|
|
@ -2,6 +2,7 @@ import {createRouter, createWebHistory} from 'vue-router'
|
|||
import Dashboard from '@/views/Dashboard.vue';
|
||||
import Login from '@/views/Login.vue';
|
||||
import Register from '@/views/Register.vue';
|
||||
import Pairing from '@/views/Pairing.vue';
|
||||
import store from '@/store';
|
||||
import Profile from '@/views/Profile.vue';
|
||||
import Settings from '@/views/Settings.vue';
|
||||
|
|
@ -15,29 +16,67 @@ import Admin from '@/views/Admin.vue';
|
|||
import Swatch from '@/views/Swatch.vue';
|
||||
import Files from '@/views/Files.vue';
|
||||
|
||||
import Account from '@/views/settings/Account.vue';
|
||||
import Password from '@/views/settings/Password.vue';
|
||||
import Privacy from '@/views/settings/Privacy.vue';
|
||||
import Email from '@/views/settings/Email.vue';
|
||||
import Notifications from '@/views/settings/Notifications.vue';
|
||||
import Data from '@/views/settings/Data.vue';
|
||||
|
||||
const routes = [
|
||||
{path: '/', component: Dashboard, meta: {requiresAuth: true}},
|
||||
{path: '/profile', component: Profile, meta: {requiresAuth: true}},
|
||||
{path: '/settings', component: Settings, meta: {requiresAuth: true}},
|
||||
{path: '/inventory', component: Inventory, meta: {requiresAuth: true}},
|
||||
{path: '/inventory/:id', component: InventoryDetail, meta: {requiresAuth: true}, props: true},
|
||||
{path: '/inventory/:id/edit', component: InventoryEdit, meta: {requiresAuth: true}, props: true},
|
||||
{path: '/inventory/new', component: InventoryNew, meta: {requiresAuth: true}},
|
||||
{path: '/friends', component: Friends, meta: {requiresAuth: true}},
|
||||
{path: '/files', component: Files, meta: {requiresAuth: true}},
|
||||
{path: '/admin', component: Admin, meta: {requiresAuth: true}},
|
||||
{path: '/swatch', component: Swatch, meta: {requiresAuth: true}},
|
||||
{path: '/search/:query', component: Search, meta: {requiresAuth: true}, props: true},
|
||||
{path: '/login', component: Login, meta: {requiresAuth: false}},
|
||||
{path: '/register', component: Register, meta: {requiresAuth: false}},
|
||||
{path: '/:pathMatch(.*)*', redirect: '/'}
|
||||
]
|
||||
|
||||
const routes = [{path: '/', component: Dashboard, meta: {requiresAuth: true}}, {
|
||||
path: '/inventory',
|
||||
component: Inventory,
|
||||
meta: {requiresAuth: true}
|
||||
}, {
|
||||
path: '/inventory/:id',
|
||||
component: InventoryDetail,
|
||||
meta: {requiresAuth: true},
|
||||
props: true
|
||||
}, {
|
||||
path: '/inventory/:id/edit',
|
||||
component: InventoryEdit,
|
||||
meta: {requiresAuth: true},
|
||||
props: true
|
||||
}, {path: '/inventory/new', component: InventoryNew, meta: {requiresAuth: true}}, {
|
||||
path: '/friends',
|
||||
component: Friends,
|
||||
meta: {requiresAuth: true}
|
||||
}, {path: '/files', component: Files, meta: {requiresAuth: true}}, {
|
||||
path: '/admin',
|
||||
component: Admin,
|
||||
meta: {requiresAuth: true}
|
||||
}, {path: '/swatch', component: Swatch, meta: {requiresAuth: true}}, {
|
||||
path: '/search/:query',
|
||||
component: Search,
|
||||
meta: {requiresAuth: true},
|
||||
props: true
|
||||
}, {path: '/login', component: Login, meta: {requiresAuth: false}}, {
|
||||
path: '/register',
|
||||
component: Register,
|
||||
meta: {requiresAuth: false}
|
||||
}, {path: '/pairing', component: Pairing, meta: {requiresAuth: false}}, {
|
||||
path: '/profile',
|
||||
component: Profile,
|
||||
meta: {requiresAuth: true}
|
||||
}, {
|
||||
path: '/settings', component: Settings, meta: {requiresAuth: true}, children: [{
|
||||
path: '', name: 'account', component: Account, meta: {requiresAuth: true}
|
||||
},{
|
||||
path: 'password/', name: 'password', component: Password, meta: {requiresAuth: true}
|
||||
}, {
|
||||
path: 'privacy/', name: 'privacy', component: Privacy, meta: {requiresAuth: true}
|
||||
}, {
|
||||
path: 'email/', name: 'email', component: Email, meta: {requiresAuth: true}
|
||||
}, {
|
||||
path: 'notifications/', name: 'notifications', component: Notifications, meta: {requiresAuth: true}
|
||||
}, {
|
||||
path: 'data/', name: 'data', component: Data, meta: {requiresAuth: true}
|
||||
}]
|
||||
}, {path: '/:pathMatch(.*)*', redirect: '/'}]
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
linkActiveClass: "active",
|
||||
routes,
|
||||
history: createWebHistory(), linkActiveClass: "active", routes,
|
||||
})
|
||||
|
||||
router.beforeEach((to/*, from*/) => {
|
||||
|
|
@ -45,8 +84,7 @@ router.beforeEach((to/*, from*/) => {
|
|||
if (to.meta.requiresAuth && !store.getters.isLoggedIn) {
|
||||
console.log("Not logged in, redirecting to login page")
|
||||
return {
|
||||
path: '/login',
|
||||
// save the location we were at to come back later
|
||||
path: '/login', // save the location we were at to come back later
|
||||
query: {redirect: to.fullPath},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue