Web: Fixed work process

This commit is contained in:
Alexey Safronov 2021-02-18 15:52:13 +03:00
parent 47d8405a01
commit f36d05ccf4
2 changed files with 24 additions and 50 deletions

View File

@ -131,7 +131,7 @@ class Confirm extends React.PureComponent {
this.state.userId,
EmployeeActivationStatus.Activated
)
.then(() => tryRedirectTo(defaultPage))
.then(() => window.location.replace(defaultPage))
.catch((error) => {
console.error("activate error", error);
this.setState({
@ -161,35 +161,26 @@ class Confirm extends React.PureComponent {
key
);
console.log("changePassword", res1);
const res2 = await api.people.updateActivationStatus(
activationStatus,
userId,
key
);
//TODO: Fix working process
// .then((data) => {
// const promise = new Promise((resolve, reject) => {
// setTimeout(() => {
// login(
// loginData.userName,
// loginData.passwordHash
// )(dispatch)
// .then(() => {
// resolve(loadInitInfo(dispatch));
// })
// .catch((e) => {
// reject(e);
// });
// }, 1000);
// });
console.log("updateActivationStatus", res2);
// return promise;
// })
// .then((data) => {
// return api.people.updateUser(changedData);
// })
// .then((user) => dispatch(setCurrentUser(user)));
const { login } = this.props;
const { userName, passwordHash } = loginData;
const res3 = await login(userName, passwordHash);
console.log("Login", res3);
const res4 = await api.people.updateUser(changedData);
console.log("updateUser", res4);
};
onKeyPress = (event) => {

View File

@ -138,10 +138,7 @@ class Confirm extends React.PureComponent {
});
this.createConfirmUser(registerData, loginData, this.state.key)
.then(() => {
toastr.success("User has been created successfully");
tryRedirectTo(defaultPage);
})
.then(() => window.location.replace(defaultPage))
.catch((error) => {
console.error("confirm error", error);
this.setState({
@ -161,30 +158,16 @@ class Confirm extends React.PureComponent {
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;
//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) => {