first commit

This commit is contained in:
Yu Sung
2023-08-23 00:02:18 +09:00
commit 6978618e72
25 changed files with 29929 additions and 0 deletions

51
src/router/index.js Normal file
View File

@@ -0,0 +1,51 @@
import Vue from 'vue'
import VueRouter from 'vue-router'
import store from '@/store';
import DefaultLayout from '@/layouts/default'
Vue.use(VueRouter)
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
const routes = [
{
path: '/',
name: 'DefaultLayout',
component: DefaultLayout,
children: [
{
path: '/content/list',
name: 'ContentList',
component: () => import(/* webpackChunkName: "content" */ '../views/Content/ContentList.vue')
}
]
},
{
path: '/login',
name: 'Login',
component: () => import(/* webpackChunkName: "login" */ '../views/Login/Login.vue')
},
]
const router = new VueRouter({
mode: 'history',
base: process.env.BASE_URL,
routes
})
router.beforeEach((to, from, next) => {
if (to.path !== '/login') {
const isAuthenticated = store.getters['accountStore/isAuthenticated']
if (isAuthenticated) {
next();
} else {
next('/login?redirect=' + to.fullPath)
}
} else {
next()
}
})
export default router