From 03c9f795490f22ea68002f572b29263bfa4797f4 Mon Sep 17 00:00:00 2001 From: whyour Date: Tue, 21 Dec 2021 23:42:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=99=BB=E5=BD=95=E9=80=80?= =?UTF-8?q?=E5=87=BA=E6=8E=A5=E5=8F=A3=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/config/index.ts | 2 +- src/layouts/index.tsx | 2 +- src/pages/initialization/index.tsx | 4 ++++ src/pages/login/index.tsx | 2 +- src/utils/http.ts | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/back/config/index.ts b/back/config/index.ts index 0e525291..51237c4c 100644 --- a/back/config/index.ts +++ b/back/config/index.ts @@ -77,7 +77,7 @@ export default { writePathList: [configPath, scriptPath], bakPath, apiWhiteList: [ - '/api/login', + '/api/user/login', '/open/auth/token', '/api/user/two-factor/login', '/api/system', diff --git a/src/layouts/index.tsx b/src/layouts/index.tsx index ac6295f3..8eae7a63 100644 --- a/src/layouts/index.tsx +++ b/src/layouts/index.tsx @@ -44,7 +44,7 @@ export default function (props: any) { const [collapsed, setCollapsed] = useState(false); const logout = () => { - request.post(`${config.apiPrefix}logout`).then(() => { + request.post(`${config.apiPrefix}user/logout`).then(() => { localStorage.removeItem(config.authKey); history.push('/login'); }); diff --git a/src/pages/initialization/index.tsx b/src/pages/initialization/index.tsx index 05086833..9fd8e8a6 100644 --- a/src/pages/initialization/index.tsx +++ b/src/pages/initialization/index.tsx @@ -73,6 +73,10 @@ const Initialization = () => { setFields(_fields || []); }; + useEffect(() => { + localStorage.removeItem(config.authKey); + }, []); + const steps = [ { title: '欢迎使用', diff --git a/src/pages/login/index.tsx b/src/pages/login/index.tsx index f9c1d363..ec1d1d8c 100644 --- a/src/pages/login/index.tsx +++ b/src/pages/login/index.tsx @@ -31,7 +31,7 @@ const Login = () => { setTwoFactor(false); setWaitTime(null); request - .post(`${config.apiPrefix}login`, { + .post(`${config.apiPrefix}user/login`, { data: { username: values.username, password: values.password, diff --git a/src/utils/http.ts b/src/utils/http.ts index f85f5b0f..567c66d3 100644 --- a/src/utils/http.ts +++ b/src/utils/http.ts @@ -34,7 +34,7 @@ const errorHandler = function (error: any) { const _request = extend({ timeout: 60000, params: { t: time }, errorHandler }); const apiWhiteList = [ - '/api/login', + '/api/user/login', '/open/auth/token', '/api/user/two-factor/login', '/api/system',