import React from "react"; import { Route, withRouter } from "react-router-dom"; import { getMe } from "../modules/auth"; import { compose } from "redux"; import { connect } from "react-redux"; import { WithTranslation, withTranslation } from "react-i18next"; import { Me } from "@scm-manager/ui-types"; import { ErrorPage, Page, Navigation, SubNavigation, Section, NavLink } from "@scm-manager/ui-components"; import ChangeUserPassword from "./ChangeUserPassword"; import ProfileInfo from "./ProfileInfo"; import { ExtensionPoint } from "@scm-manager/ui-extensions"; type Props = WithTranslation & { me: Me; // Context props match: any; }; type State = {}; class Profile extends React.Component { stripEndingSlash = (url: string) => { if (url.endsWith("/")) { return url.substring(0, url.length - 2); } return url; }; matchedUrl = () => { return this.stripEndingSlash(this.props.match.url); }; render() { const url = this.matchedUrl(); const { me, t } = this.props; if (!me) { return ( ); } const extensionProps = { me, url }; return (
} /> } />
); } } const mapStateToProps = (state: any) => { return { me: getMe(state) }; }; export default compose(withTranslation("commons"), connect(mapStateToProps), withRouter)(Profile);