all repos — caroster @ 22203f7cbfc69314554a1a097832721037d7f78f

[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';
 8import useProfile from '../hooks/useProfile';
 9
10const ProfilePage = () => {
11  const history = useHistory();
12  const {t} = useTranslation();
13  const {logout, updateProfile} = useAuth();
14  const {profile} = useProfile();
15
16  const menuActions = [
17    {
18      label: t('menu.new_event'),
19      onClick: () => history.push('/new'),
20      id: 'AddEventTabs',
21    },
22    {
23      label: t('menu.dashboard'),
24      onClick: () => history.push('/dashboard'),
25      id: 'DashboardTabs',
26    },
27    {
28      label: t('menu.logout'),
29      onClick: logout,
30      id: 'LogoutTabs',
31    },
32  ];
33
34  if (!profile) return <Loading />;
35
36  return (
37    <Layout menuTitle={t('profile.title')} menuActions={menuActions}>
38      <Profile
39        profile={profile}
40        updateProfile={updateProfile}
41        logout={logout}
42      />
43    </Layout>
44  );
45};
46
47export default ProfilePage;