Web: Fixed work process
This commit is contained in:
parent
47d8405a01
commit
f36d05ccf4
@ -131,7 +131,7 @@ class Confirm extends React.PureComponent {
|
|||||||
this.state.userId,
|
this.state.userId,
|
||||||
EmployeeActivationStatus.Activated
|
EmployeeActivationStatus.Activated
|
||||||
)
|
)
|
||||||
.then(() => tryRedirectTo(defaultPage))
|
.then(() => window.location.replace(defaultPage))
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error("activate error", error);
|
console.error("activate error", error);
|
||||||
this.setState({
|
this.setState({
|
||||||
@ -161,35 +161,26 @@ class Confirm extends React.PureComponent {
|
|||||||
key
|
key
|
||||||
);
|
);
|
||||||
|
|
||||||
|
console.log("changePassword", res1);
|
||||||
|
|
||||||
const res2 = await api.people.updateActivationStatus(
|
const res2 = await api.people.updateActivationStatus(
|
||||||
activationStatus,
|
activationStatus,
|
||||||
userId,
|
userId,
|
||||||
key
|
key
|
||||||
);
|
);
|
||||||
|
|
||||||
//TODO: Fix working process
|
console.log("updateActivationStatus", res2);
|
||||||
// .then((data) => {
|
|
||||||
// const promise = new Promise((resolve, reject) => {
|
|
||||||
// setTimeout(() => {
|
|
||||||
// login(
|
|
||||||
// loginData.userName,
|
|
||||||
// loginData.passwordHash
|
|
||||||
// )(dispatch)
|
|
||||||
// .then(() => {
|
|
||||||
// resolve(loadInitInfo(dispatch));
|
|
||||||
// })
|
|
||||||
// .catch((e) => {
|
|
||||||
// reject(e);
|
|
||||||
// });
|
|
||||||
// }, 1000);
|
|
||||||
// });
|
|
||||||
|
|
||||||
// return promise;
|
const { login } = this.props;
|
||||||
// })
|
const { userName, passwordHash } = loginData;
|
||||||
// .then((data) => {
|
|
||||||
// return api.people.updateUser(changedData);
|
const res3 = await login(userName, passwordHash);
|
||||||
// })
|
|
||||||
// .then((user) => dispatch(setCurrentUser(user)));
|
console.log("Login", res3);
|
||||||
|
|
||||||
|
const res4 = await api.people.updateUser(changedData);
|
||||||
|
|
||||||
|
console.log("updateUser", res4);
|
||||||
};
|
};
|
||||||
|
|
||||||
onKeyPress = (event) => {
|
onKeyPress = (event) => {
|
||||||
|
@ -138,10 +138,7 @@ class Confirm extends React.PureComponent {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.createConfirmUser(registerData, loginData, this.state.key)
|
this.createConfirmUser(registerData, loginData, this.state.key)
|
||||||
.then(() => {
|
.then(() => window.location.replace(defaultPage))
|
||||||
toastr.success("User has been created successfully");
|
|
||||||
tryRedirectTo(defaultPage);
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error("confirm error", error);
|
console.error("confirm error", error);
|
||||||
this.setState({
|
this.setState({
|
||||||
@ -161,30 +158,16 @@ class Confirm extends React.PureComponent {
|
|||||||
|
|
||||||
const user = await api.people.createUser(data, key);
|
const user = await api.people.createUser(data, key);
|
||||||
|
|
||||||
|
console.log("Created user", user);
|
||||||
|
|
||||||
|
const { login } = this.props;
|
||||||
|
const { userName, passwordHash } = loginData;
|
||||||
|
|
||||||
|
const response = await login(userName, passwordHash);
|
||||||
|
|
||||||
|
console.log("Login", response);
|
||||||
|
|
||||||
return user;
|
return user;
|
||||||
|
|
||||||
//TODO: Fix working process
|
|
||||||
// dispatch(setCurrentUser(user));
|
|
||||||
// })
|
|
||||||
// .then(() => {
|
|
||||||
// const promise = new Promise((resolve, reject) => {
|
|
||||||
// setTimeout(() => {
|
|
||||||
// login(
|
|
||||||
// loginData.userName,
|
|
||||||
// loginData.passwordHash
|
|
||||||
// )(dispatch)
|
|
||||||
// .then(() => {
|
|
||||||
// resolve(loadInitInfo(dispatch));
|
|
||||||
// })
|
|
||||||
// .catch((e) => {
|
|
||||||
// reject(e);
|
|
||||||
// });
|
|
||||||
// }, 1000);
|
|
||||||
// });
|
|
||||||
|
|
||||||
// return promise;
|
|
||||||
// });
|
|
||||||
// };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
onKeyPress = (event) => {
|
onKeyPress = (event) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user