all repos — caroster @ 14703ccf1e17e3b9d925f9a5521fde681209f4ed

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

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

 1import React from 'react';
 2import {useAuth, useStrapi} 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  const strapi = useStrapi();
16  const [settings] = strapi.stores?.settings || [{}];
17
18  const menuActions = [
19    {
20      label: t('menu.new_event'),
21      onClick: () => history.push('/new'),
22      id: 'AddEventTabs',
23    },
24    {
25      label: t('menu.dashboard'),
26      onClick: () => history.push('/dashboard'),
27      id: 'DashboardTabs',
28    },
29  ];
30
31  if (!profile) return <Loading />;
32
33  return (
34    <Layout menuTitle={t('profile.title')} menuActions={menuActions}>
35      <Profile
36        profile={profile}
37        updateProfile={updateProfile}
38        logout={() => logout(settings['about_link'])}
39      />
40    </Layout>
41  );
42};
43
44export default ProfilePage;