From fe8ce7885271aeb90773170580214be98aeb1491 Mon Sep 17 00:00:00 2001 From: "wenyu.dai" <“wenyu.dai@qq.com”> Date: Wed, 22 Dec 2021 15:31:18 +0800 Subject: [PATCH] the login error message did not fit (#168) --- src/models/login.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/models/login.js b/src/models/login.js index 3bfa7e222..a98bc3ddf 100644 --- a/src/models/login.js +++ b/src/models/login.js @@ -42,8 +42,8 @@ export default { currentAuthority: "admin" } }); - window.sessionStorage.setItem("token",response.data.token); - window.sessionStorage.setItem("userName",response.data.userName); + window.sessionStorage.setItem("token", response.data.token); + window.sessionStorage.setItem("userName", response.data.userName); /* const urlParams = new URL(window.location.href); const params = getPageQuery(); let { redirect } = params; @@ -63,7 +63,11 @@ export default { yield put(routerRedux.push("/home")); } else { message.destroy(); - message.error("Incorrect user name or password"); + if (response.code === 404) { + message.error("Incorrect user name or password"); + } else { + message.error(response.message); + } } }, *logout(_, { put }) { @@ -76,10 +80,10 @@ export default { }); window.sessionStorage.removeItem("token"); window.sessionStorage.removeItem("userName"); - yield put( + yield put( routerRedux.push({ - pathname: "/user/login", - /* search: stringify({ + pathname: "/user/login" + /* search: stringify({ redirect: window.location.href }) */ })