success validate getting token via cookie
This commit is contained in:
+3
-3
@@ -1,8 +1,8 @@
|
||||
version: '3'
|
||||
services:
|
||||
zhishuyun-auth-frontend:
|
||||
container_name: 'zhishuyun-auth-frontend'
|
||||
zhishuyun-academy-frontend:
|
||||
container_name: 'zhishuyun-academy-frontend'
|
||||
build: ./
|
||||
image: 'ghcr.io/zhishuyun/zhishuyun-auth-frontend:${BUILD_NUMBER}'
|
||||
image: 'ghcr.io/zhishuyun/zhishuyun-academy-frontend:${BUILD_NUMBER}'
|
||||
ports:
|
||||
- '8086:80'
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<template>
|
||||
<div>
|
||||
<h1>Course List</h1>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,15 @@
|
||||
export default {
|
||||
path: '/course',
|
||||
name: 'course',
|
||||
meta: {
|
||||
auth: true
|
||||
},
|
||||
component: () => import('@/layouts/Course.vue'),
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
name: 'course-list',
|
||||
component: () => import('@/pages/course/List.vue')
|
||||
}
|
||||
]
|
||||
};
|
||||
+3
-2
@@ -1,8 +1,9 @@
|
||||
import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router';
|
||||
import auth from './auth';
|
||||
import course from './course';
|
||||
import store from '@/store';
|
||||
|
||||
const routes = [auth];
|
||||
const routes = [auth, course];
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
@@ -14,7 +15,7 @@ router.beforeEach((to, from, next) => {
|
||||
if (to.matched.some((record) => record.meta.auth)) {
|
||||
if (!store.getters.authenticated) {
|
||||
next({
|
||||
name: 'login',
|
||||
name: 'auth-login',
|
||||
query: { redirect: to.fullPath }
|
||||
});
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user