From 377283711dcaca1036b9659729785ba73b8410cb Mon Sep 17 00:00:00 2001 From: Alec Watson Date: Fri, 26 Jul 2024 09:56:53 +0200 Subject: [PATCH] Fix to org returns --- CoVAR-app/src/functions/requests.tsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/CoVAR-app/src/functions/requests.tsx b/CoVAR-app/src/functions/requests.tsx index e722bb8..236b2be 100644 --- a/CoVAR-app/src/functions/requests.tsx +++ b/CoVAR-app/src/functions/requests.tsx @@ -193,7 +193,19 @@ export const fetchUsersByOrg = async (orgId: string, accessToken: string) => { data: { org_id: orgId }, headers: { Authorization: `Bearer ${accessToken}` }, }; - return await handleRequest(request); + + try { + const response = await handleRequest(request); + return response.map((user: any) => ({ + id: user.user_id, + email: user.username, + role: user.role, + createdAt: user.createdAt, + })); + } catch (error) { + console.error('Error fetching users:', error); + throw error; + } }; export const removeUser = async (orgId: string, ownerId: string, email: string, accessToken: string) => {