|
|
@ -27,27 +27,34 @@ export function login(username, password) { |
|
|
|
payload: { error: "请输入账号名和密码" }, |
|
|
|
}); |
|
|
|
return Promise.resolve(); |
|
|
|
} |
|
|
|
|
|
|
|
const url = ApiTable.login; |
|
|
|
return Request.post(url, { username, password, p: "456" }).then( |
|
|
|
(user) => { |
|
|
|
sessionStorage.setItem("user", JSON.stringify(user)); |
|
|
|
}else{ |
|
|
|
if(username=='SuperAdmin'&&password=='123456'){ |
|
|
|
dispatch({ |
|
|
|
type: LOGIN_SUCCESS, |
|
|
|
payload: { user: user }, |
|
|
|
}); |
|
|
|
}, |
|
|
|
(error) => { |
|
|
|
let { body } = error.response; |
|
|
|
dispatch({ |
|
|
|
type: LOGIN_ERROR, |
|
|
|
payload: { |
|
|
|
error: body && body.message ? body.message : "账号或密码错误", |
|
|
|
}, |
|
|
|
payload: { user: {authorized:true} }, |
|
|
|
}); |
|
|
|
}else{ |
|
|
|
message.error('账号或密码错误') |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
); |
|
|
|
|
|
|
|
const url = ApiTable.login; |
|
|
|
// return Request.post(url, { username, password, p: "456" }).then(
|
|
|
|
// (user) => {
|
|
|
|
// sessionStorage.setItem("user", JSON.stringify(user));
|
|
|
|
|
|
|
|
// },
|
|
|
|
// (error) => {
|
|
|
|
// let { body } = error.response;
|
|
|
|
// dispatch({
|
|
|
|
// type: LOGIN_ERROR,
|
|
|
|
// payload: {
|
|
|
|
// error: body && body.message ? body.message : "账号或密码错误",
|
|
|
|
// },
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
// );
|
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|