mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-14 01:15:44 +01:00
fix review findings
This commit is contained in:
@@ -22,42 +22,37 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import {connect} from "react-redux";
|
||||
import {WithTranslation, withTranslation} from "react-i18next";
|
||||
|
||||
import { getLogoutFailure, logout } from "../modules/auth";
|
||||
import { ErrorPage, Loading } from "@scm-manager/ui-components";
|
||||
import { getLogoutLink } from "../modules/indexResource";
|
||||
import { RouteComponentProps, withRouter } from "react-router-dom";
|
||||
import { compose } from "redux";
|
||||
import {getLogoutFailure, logout} from "../modules/auth";
|
||||
import {ErrorPage, Loading} from "@scm-manager/ui-components";
|
||||
import {getLogoutLink} from "../modules/indexResource";
|
||||
import {RouteComponentProps, withRouter} from "react-router-dom";
|
||||
import {compose} from "redux";
|
||||
|
||||
type Props = RouteComponentProps &
|
||||
WithTranslation & {
|
||||
error: Error;
|
||||
logoutLink: string;
|
||||
error: Error;
|
||||
logoutLink: string;
|
||||
|
||||
// dispatcher functions
|
||||
logout: (link: string) => void;
|
||||
};
|
||||
// dispatcher functions
|
||||
logout: (link: string, callback: () => void) => void;
|
||||
};
|
||||
|
||||
class Logout extends React.Component<Props> {
|
||||
componentDidMount() {
|
||||
new Promise((resolve, reject) => {
|
||||
setTimeout(() => {
|
||||
if (this.props.logoutLink) {
|
||||
this.props.logout(this.props.logoutLink);
|
||||
resolve(this.props.history.push("/login"));
|
||||
}
|
||||
});
|
||||
});
|
||||
if (this.props.logoutLink) {
|
||||
this.props.logout(this.props.logoutLink, () => this.props.history.push("/login"));
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const { error, t } = this.props;
|
||||
const {error, t} = this.props;
|
||||
if (error) {
|
||||
return <ErrorPage title={t("logout.error.title")} subtitle={t("logout.error.subtitle")} error={error} />;
|
||||
return <ErrorPage title={t("logout.error.title")} subtitle={t("logout.error.subtitle")} error={error}/>;
|
||||
} else {
|
||||
return <Loading />;
|
||||
return <Loading/>;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -73,7 +68,7 @@ const mapStateToProps = (state: any) => {
|
||||
|
||||
const mapDispatchToProps = (dispatch: any) => {
|
||||
return {
|
||||
logout: (link: string) => dispatch(logout(link))
|
||||
logout: (link: string, callback: () => void) => dispatch(logout(link, callback))
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -24,7 +24,13 @@
|
||||
import React from "react";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { Me } from "@scm-manager/ui-types";
|
||||
import { AvatarImage, AvatarWrapper, MailLink } from "@scm-manager/ui-components";
|
||||
import {
|
||||
AvatarImage,
|
||||
AvatarWrapper,
|
||||
MailLink,
|
||||
createAttributesForTesting,
|
||||
replaceSpacesInTestId
|
||||
} from "@scm-manager/ui-components";
|
||||
|
||||
type Props = WithTranslation & {
|
||||
me: Me;
|
||||
@@ -47,11 +53,11 @@ class ProfileInfo extends React.Component<Props> {
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>{t("profile.username")}</th>
|
||||
<td>{me.name}</td>
|
||||
<td {...createAttributesForTesting(replaceSpacesInTestId(me.name))}>{me.name}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{t("profile.displayName")}</th>
|
||||
<td>{me.displayName}</td>
|
||||
<td {...createAttributesForTesting(replaceSpacesInTestId(me.displayName))}>{me.displayName}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{t("profile.mail")}</th>
|
||||
|
||||
Reference in New Issue
Block a user