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',