all repos — caroster @ dcc5aca696a7224dc83660d34506257db74c7083

[Octree] Group carpool to your event https://caroster.io

app/src/pages/Profile.js (view raw)

 1import React from 'react';
 2import {useAuth} from 'strapi-react-context';
 3import Layout from '../layouts/Centered';
 4import {useTranslation} from 'react-i18next';
 5import {useHistory} from 'react-router-dom';
 6import Loading from './Loading';
 7import Profile from '../containers/Profile';
 8
 9const ProfilePage = () => {
10  const history = useHistory();
11  const {t} = useTranslation();
12  const {authState, logout, updateProfile} = useAuth();
13
14  const menuActions = [
15    {
16      label: t('menu.new_event'),
17      onClick: () => history.push('/new'),
18      id: 'AddEventTabs',
19    },
20    {
21      label: t('menu.dashboard'),
22      onClick: () => history.push('/dashboard'),
23      id: 'DashboardTabs',
24    },
25    {
26      label: t('menu.logout'),
27      onClick: logout,
28      id: 'LogoutTabs',
29    },
30  ];
31
32  if (!authState) return <Loading />;
33
34  return (
35    <Layout menuTitle={t('profile.title')} menuActions={menuActions}>
36      <Profile
37        profile={authState.user}
38        updateProfile={updateProfile}
39        logout={logout}
40      />
41    </Layout>
42  );
43};
44
45export default ProfilePage;