diff --git a/web/src/App.vue b/web/src/App.vue
index da2025c..162540b 100644
--- a/web/src/App.vue
+++ b/web/src/App.vue
@@ -1,18 +1,11 @@
-
-
+
diff --git a/web/src/router/index.ts b/web/src/router/index.ts
index 1dbd9eb..9336e0f 100644
--- a/web/src/router/index.ts
+++ b/web/src/router/index.ts
@@ -1,26 +1,33 @@
import { useAuthService } from "@/services/auth";
import { createRouter, createWebHistory, type RouteRecordRaw } from "vue-router";
+import Layout from "@/components/Layout.vue";
const routes: Array = [
{
path: "/",
- name: "dashboard",
- component: () => import("@/views/Dashboard.vue"),
- },
- {
- path: "/keys",
- name: "keys",
- component: () => import("@/views/Keys.vue"),
- },
- {
- path: "/logs",
- name: "logs",
- component: () => import("@/views/Logs.vue"),
- },
- {
- path: "/settings",
- name: "settings",
- component: () => import("@/views/Settings.vue"),
+ component: Layout,
+ children: [
+ {
+ path: "",
+ name: "dashboard",
+ component: () => import("@/views/Dashboard.vue"),
+ },
+ {
+ path: "keys",
+ name: "keys",
+ component: () => import("@/views/Keys.vue"),
+ },
+ {
+ path: "logs",
+ name: "logs",
+ component: () => import("@/views/Logs.vue"),
+ },
+ {
+ path: "settings",
+ name: "settings",
+ component: () => import("@/views/Settings.vue"),
+ },
+ ],
},
{
path: "/login",
diff --git a/web/src/utils/http.ts b/web/src/utils/http.ts
index e303527..c10663f 100644
--- a/web/src/utils/http.ts
+++ b/web/src/utils/http.ts
@@ -45,9 +45,11 @@ http.interceptors.response.use(
// The request was made and the server responded with a status code
// that falls out of the range of 2xx
if (error.response.status === 401) {
- const { logout } = useAuthService();
- logout();
- window.location.href = "/login";
+ if (window.location.pathname !== "/login") {
+ const { logout } = useAuthService();
+ logout();
+ window.location.href = "/login";
+ }
}
window.$message.error(error.response.data?.message || `请求失败: ${error.response.status}`);
} else if (error.request) {
diff --git a/web/src/views/Login.vue b/web/src/views/Login.vue
index 4b758f4..82f6e59 100644
--- a/web/src/views/Login.vue
+++ b/web/src/views/Login.vue
@@ -22,8 +22,6 @@ const handleLogin = async () => {
loading.value = false;
if (success) {
router.push("/");
- } else {
- message.error("登录失败,请检查您的授权密钥");
}
};