Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the login error message did not fit (#168) #171

Merged
merged 1 commit into from
Dec 22, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions src/models/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 }) {
Expand All @@ -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
}) */
})
Expand Down