登陆成功跳转到团计划

release
Jimmy Liow 2 years ago
parent b9938d2c19
commit 044c5c3b8a

@ -19,12 +19,7 @@ class Auth {
return fetchJSON(fetchUrl)
.then(json => {
if (json.errcode == 0) {
runInAction(() => {
this.login = {
userId: json.Result.WU_LMI_SN,
username: json.Result.WU_UserName,
}
});
return json.Result.WU_LMI_SN;
} else {
throw new Error(json.errmsg + ': ' + json.errcode);
}
@ -48,6 +43,7 @@ class Auth {
cityId: json.Result.citysn
}
});
return json.Result.LoginName;
} else {
throw new Error(json.errmsg + ': ' + json.errcode);
}

@ -1,20 +1,44 @@
import { useNavigate } from "react-router-dom";
import { Button, Checkbox, Form, Input, Row, App } from 'antd';
import { useStore } from '@/stores/StoreContext.js';
function Login() {
const { authStore } = useStore();
const navigate = useNavigate();
const { notification } = App.useApp();
const onFinish = (values) => {
console.log('Success:', values);
authStore.valdateUserPassword(values.username, values.password);
authStore.valdateUserPassword(values.username, values.password)
.then((userId) => {
authStore.fetchUserDetail(userId)
.then((user) => {
// navigate(-1) is equivalent to hitting the back button.
navigate("/reservation/newest");
})
.catch(ex => {
notification.error({
message: `Notification`,
description: ex.message,
placement: 'top',
duration: 4,
});
});
})
.catch(ex => {
notification.error({
message: `Notification`,
description: ex.message,
placement: 'top',
duration: 4,
});
});
};
const onFinishFailed = (errorInfo) => {
console.log('Failed:', errorInfo);
};
return (
<Row justify="center" align="middle" style={{ minHeight: 500 }}>
<Form
@ -47,7 +71,6 @@ function Login() {
>
<Input />
</Form.Item>
<Form.Item
label="Password"
name="password"
@ -60,7 +83,6 @@ function Login() {
>
<Input.Password />
</Form.Item>
<Form.Item
name="remember"
valuePropName="checked"
@ -71,7 +93,6 @@ function Login() {
>
<Checkbox>Remember me</Checkbox>
</Form.Item>
<Form.Item
wrapperCol={{
offset: 8,

Loading…
Cancel
Save