diff --git a/package.json b/package.json index c295c04d..e382e811 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "opensabre-admin", "description": "Opensabre开发管理平台", - "version": "4.0.0", + "version": "1.1.3", "private": true, "packageManager": "pnpm@10.26.2", "type": "module", diff --git a/src/utils/request.ts b/src/utils/request.ts index e3e23a95..e4d53ed2 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -13,7 +13,10 @@ import { normalizeDateTimeValues } from "@/utils/format"; const http = axios.create({ baseURL: import.meta.env.VITE_APP_BASE_API, timeout: 50000, - headers: { "Content-Type": "application/json;charset=utf-8" }, + headers: { + Accept: "application/json", + "Content-Type": "application/json;charset=utf-8", + }, paramsSerializer: (params) => qs.stringify(params), }); diff --git a/src/views/security/online-user/index.vue b/src/views/security/online-user/index.vue index 5f222971..d14d9430 100644 --- a/src/views/security/online-user/index.vue +++ b/src/views/security/online-user/index.vue @@ -25,17 +25,33 @@ highlight-current-row border class="table-section__content" + row-key="sessionId" + empty-text="暂无在线用户" > + + + + + + {{ row.authenticationType || "-" }} + + + {{ clientSummary(row.userAgent) }} + + + {{ row.sessionId || "-" }} + + + {{ row.userAgent || "-" }} + + + + + - @@ -57,12 +73,6 @@ {{ formatDateTime(row.lastAccessTime) }} - - - - {{ clientSummary(row.userAgent) }} - - { fetchData(); }); + + diff --git a/tests/unit/utils/request.test.ts b/tests/unit/utils/request.test.ts index 75438499..484b561b 100644 --- a/tests/unit/utils/request.test.ts +++ b/tests/unit/utils/request.test.ts @@ -42,6 +42,10 @@ describe("HTTP 响应拦截器", () => { vi.clearAllMocks(); }); + it("API 请求只声明接受 JSON,避免未认证请求被识别为页面导航", () => { + expect(request.defaults.headers.Accept).toBe("application/json"); + }); + it("API 被重定向到登录页并返回 HTML 时跳转登录", async () => { const promise = request({ url: "/api/org/user/current",