Web: People: fix redirect

This commit is contained in:
Viktor Fomin 2022-07-20 00:49:11 +03:00
parent 66b0e8c303
commit 3123ba7993
2 changed files with 8 additions and 8 deletions

View File

@ -4,6 +4,7 @@ import ModalDialog from "@appserver/components/modal-dialog";
import Button from "@appserver/components/button";
import Text from "@appserver/components/text";
import { withTranslation } from "react-i18next";
import { withRouter } from "react-router";
import ModalDialogContainer from "../ModalDialogContainer";
import toastr from "studio/toastr";
@ -13,11 +14,11 @@ class ResetApplicationDialogComponent extends React.Component {
}
resetApp = async () => {
const { resetTfaApp, id, onClose, logout } = this.props;
const { resetTfaApp, id, onClose, history } = this.props;
onClose && onClose();
try {
const res = await resetTfaApp(id);
if (res) logout(true, res);
if (res) history.push(res.replace(window.location.origin, ""));
} catch (e) {
toastr.error(e);
}
@ -60,17 +61,17 @@ class ResetApplicationDialogComponent extends React.Component {
}
}
const ResetApplicationDialog = withTranslation([
"ResetApplicationDialog",
"Common",
])(ResetApplicationDialogComponent);
const ResetApplicationDialog = withRouter(
withTranslation(["ResetApplicationDialog", "Common"])(
ResetApplicationDialogComponent
)
);
ResetApplicationDialog.propTypes = {
visible: PropTypes.bool.isRequired,
onClose: PropTypes.func.isRequired,
resetTfaApp: PropTypes.func.isRequired,
id: PropTypes.string.isRequired,
logout: PropTypes.func.isRequired,
};
export default ResetApplicationDialog;

View File

@ -569,7 +569,6 @@ class SectionBodyContent extends React.PureComponent {
onClose={this.toggleResetAppDialogVisible}
resetTfaApp={this.props.resetTfaApp}
id={profile.id}
logout={this.props.logout}
/>
)}
{backupCodesDialogVisible && (