From 99027ba2e3af1e48c1324003c41f03e235abecc5 Mon Sep 17 00:00:00 2001 From: Alec Li Date: Wed, 14 Feb 2024 21:13:57 -0800 Subject: [PATCH] Add statuses for export page --- .../src/components/data_export/DataExport.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/csm_web/frontend/src/components/data_export/DataExport.tsx b/csm_web/frontend/src/components/data_export/DataExport.tsx index 1ce3749c..5cadff82 100644 --- a/csm_web/frontend/src/components/data_export/DataExport.tsx +++ b/csm_web/frontend/src/components/data_export/DataExport.tsx @@ -1,10 +1,22 @@ import React, { useState } from "react"; +import { useProfiles } from "../../utils/queries/base"; +import { Role } from "../../utils/types"; +import LoadingSpinner from "../LoadingSpinner"; import { ExportType } from "./DataExportTypes"; import { ExportPage } from "./ExportPage"; import { ExportSelector } from "./ExportSelector"; export const DataExport = () => { const [dataExportType, setDataExportType] = useState(null); + const { data: profiles, isSuccess: profilesLoaded, isError: profilesError } = useProfiles(); + + if (profilesError) { + return Error loading user profiles.; + } else if (!profilesLoaded) { + return ; + } else if (profilesLoaded && !profiles.some(profile => profile.role === Role.COORDINATOR)) { + return Permission denied; you are not a coordinator for any course.; + } return (