From f103858fe05201d5c80e4630fa8655cd1830510d Mon Sep 17 00:00:00 2001 From: NanamiAdmin Date: Tue, 10 Mar 2026 19:05:56 +0800 Subject: [PATCH] feat(TopBar): add user settings & logout btn and finish logout function refactor(auth): rename login-token to token for consistency Update all token references from 'login-token' to 'token' across the application. Also enhance TopBar with user menu functionality including logout and settings options. - Standardize token cookie name for better maintainability - Add dropdown menu to TopBar with logout functionality - Implement click-outside behavior for menu - Improve TopBar styling and user interaction --- src/api/index.js | 2 +- src/components/TopBar.vue | 124 +++++++++++++++++++++++++++++++++++--- src/router/index.js | 2 +- src/views/Login.vue | 2 +- 4 files changed, 120 insertions(+), 10 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index 6a20e3e..f846f0b 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -8,7 +8,7 @@ const api = axios.create({ api.interceptors.request.use( config => { - const token = getCookie('login-token'); + const token = getCookie('token'); if (token) { config.headers['X-Token'] = token; } diff --git a/src/components/TopBar.vue b/src/components/TopBar.vue index e8e8945..3edce4b 100644 --- a/src/components/TopBar.vue +++ b/src/components/TopBar.vue @@ -22,18 +22,31 @@
v{{ softwareInfo.Version }}
-
-
{{ username.charAt(0).toUpperCase() }}
- {{ username }} +