all repos — caroster @ 0a157f5b51b85a50e27d205dc4db64776b5d6182

[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
29  if (!profile) return <Loading />;
30
31  return (
32    <Layout menuTitle={t('profile.title')} menuActions={menuActions} goBack>
33      <Profile
34        profile={profile}
35        updateProfile={updateProfile}
36        logout={logout}
37      />
38    </Layout>
39  );
40};
41
42export default ProfilePage;