feat: 登录接口联调
This commit is contained in:
@@ -2,11 +2,15 @@ import { createRouter, createMemoryHistory } from "vue-router";
|
||||
|
||||
const routes = [
|
||||
{
|
||||
path: "/",
|
||||
component: () => import("@renderer/views/login/index.vue"),
|
||||
name: "Login",
|
||||
meta: { requiresAuth: false },
|
||||
}
|
||||
path: '/',
|
||||
redirect: '/home'
|
||||
},
|
||||
{
|
||||
path: "/home",
|
||||
component: () => import("@renderer/views/home/index.vue"),
|
||||
name: "Home",
|
||||
meta: { requiresAuth: true },
|
||||
},
|
||||
];
|
||||
|
||||
const router = createRouter({
|
||||
@@ -21,24 +25,4 @@ const router = createRouter({
|
||||
},
|
||||
});
|
||||
|
||||
// router.beforeEach((to: any, from: any, next: any) => {
|
||||
// const token = localStorage.getItem("token");
|
||||
// if (to.meta && (to.meta as any).requiresAuth && !token) {
|
||||
// next({ path: "/login" });
|
||||
// return;
|
||||
// }
|
||||
|
||||
// if (token && to.path === "/login") {
|
||||
// next({ path: "/home" });
|
||||
// return;
|
||||
// }
|
||||
|
||||
// if (token && to.path === "/") {
|
||||
// next({ path: "/home" });
|
||||
// return;
|
||||
// }
|
||||
|
||||
// next();
|
||||
// });
|
||||
|
||||
export default router;
|
||||
|
||||
Reference in New Issue
Block a user