From 5f3b59da6248745d0b198398854426fc94ca465a Mon Sep 17 00:00:00 2001 From: supapesh Date: Fri, 8 Apr 2022 15:56:44 +0200 Subject: [PATCH] feat: display all functionalities if organizer --- frontend/src/pages/Dashboard.tsx | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/frontend/src/pages/Dashboard.tsx b/frontend/src/pages/Dashboard.tsx index 3b4fd593..7f311df0 100644 --- a/frontend/src/pages/Dashboard.tsx +++ b/frontend/src/pages/Dashboard.tsx @@ -6,6 +6,7 @@ import { isApplicationPeriodActive, getAdmissionPeriod, } from '../services/Applications' +import isOrganizer from '../utils/isOrganizer' const useStyles = createStyles((theme) => ({ dashboardWrapper: { @@ -74,10 +75,14 @@ function Dashboard() { const [periodOpen, setPeriodOpen] = useState(false) const [startDate, setStartDate] = useState('') const [endDate, setEndDate] = useState('') + const [isTheOrganizer, setTheOrganizer] = useState(false) useEffect(() => { const getApplicationPeriodActiveAsync = async () => { try { + if (await isOrganizer()) { + setTheOrganizer(true) + } const response = await isApplicationPeriodActive() setPeriodOpen(response) if (response) { @@ -136,12 +141,14 @@ function Dashboard() { > Opptaksstatus - navigate('/admission-period')} - > - Opptaksperiode - + {isTheOrganizer && ( + navigate('/admission-period')} + > + Opptaksperiode + + )} )