// @flow 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 { translate } from "react-i18next"; import type { 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"; type Props = { me: Me, // Context props t: string => string, 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 ( ); } return (
} /> } />
); } } const mapStateToProps = state => { return { me: getMe(state) }; }; export default compose( translate("commons"), connect(mapStateToProps), withRouter )(Profile);