Create ProfilePage container

Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
soupette 2020-05-19 08:46:10 +02:00 committed by Alexandre Bodin
parent b871d26eaf
commit 9bc1791d5d
3 changed files with 19 additions and 14 deletions

View File

@ -8,7 +8,6 @@
import React, { useState } from 'react';
import { FormattedMessage } from 'react-intl';
import { withRouter } from 'react-router-dom';
import { get } from 'lodash';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { ButtonDropdown, DropdownItem, DropdownMenu, DropdownToggle } from 'reactstrap';
import { auth } from 'strapi-helper-plugin';
@ -16,24 +15,20 @@ import Wrapper from './components';
const Logout = ({ history: { push } }) => {
const [isOpen, setIsOpen] = useState(false);
const toggle = () => setIsOpen(prev => !prev);
const handleGoTo = () => {
const id = get(auth.getUserInfo(), 'id');
const handleGoTo = () => {
push({
pathname: `/plugins/content-manager/collectionType/strapi::administrator/${id}`,
search: '?redirectUrl=/plugins/content-manager/collectionType/strapi::administrator',
});
};
const handleGoToAdministrator = () => {
push({
pathname: '/plugins/content-manager/collectionType/strapi::administrator',
pathname: `/me`,
});
};
const handleLogout = () => {
auth.clearAppStorage();
push('/auth/login');
};
const toggle = () => setIsOpen(prev => !prev);
const userInfo = auth.getUserInfo();
const displayName = userInfo.username || `${userInfo.firstname} ${userInfo.lastname}`;
@ -48,9 +43,6 @@ const Logout = ({ history: { push } }) => {
<DropdownItem onClick={handleGoTo} className="item">
<FormattedMessage id="app.components.Logout.profile" />
</DropdownItem>
<DropdownItem onClick={handleGoToAdministrator} className="item">
<FormattedMessage id="app.components.Logout.admin" />
</DropdownItem>
<DropdownItem onClick={handleLogout}>
<FormattedMessage id="app.components.Logout.logout" />
<FontAwesomeIcon icon="sign-out-alt" />

View File

@ -34,6 +34,7 @@ import NotFoundPage from '../NotFoundPage';
import OnboardingVideos from '../Onboarding';
import SettingsPage from '../SettingsPage';
import PluginDispatcher from '../PluginDispatcher';
import ProfilePage from '../ProfilePage';
import {
disableGlobalOverlayBlocker,
enableGlobalOverlayBlocker,
@ -186,6 +187,7 @@ export class Admin extends React.Component {
<Content>
<Switch>
<Route path="/" render={props => this.renderRoute(props, HomePage)} exact />
<Route path="/me" component={ProfilePage} />
<Route path="/plugins/:pluginId" render={this.renderPluginDispatcher} />
<Route
path="/list-plugins"

View File

@ -0,0 +1,11 @@
import React from 'react';
const ProfilePage = () => {
return (
<div>
<div>COMING SOON</div>
</div>
);
};
export default ProfilePage;