From 8a897cf4ed2e578e8e3dcd66aa6fbc1893cbd6ff Mon Sep 17 00:00:00 2001 From: lukas Date: Fri, 8 Nov 2024 16:12:16 +0100 Subject: [PATCH] fix: staging build failed --- src/api/archive/archive.get.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/api/archive/archive.get.ts b/src/api/archive/archive.get.ts index 7d39221fa..07389117d 100644 --- a/src/api/archive/archive.get.ts +++ b/src/api/archive/archive.get.ts @@ -11,11 +11,16 @@ const BASE_URL = '/api/archives'; export const useListArchives = () => { const { user } = React.useContext(UserContext); - const hasAccess = user?.type === [UserType.SUPER_ADMIN, UserType.ADMIN, UserType.MEDIATOR].find((type) => type === user?.type); - if (!hasAccess) return; + const hasAccess = user?.type === UserType.SUPER_ADMIN || user?.type === UserType.ADMIN || user?.type === UserType.MEDIATOR; - return useQuery(['archives'], async () => { - const { data } = await axios.get(`${BASE_URL}`); - return data; - }); + return useQuery( + ['archives'], + async () => { + const { data } = await axios.get(`${BASE_URL}`); + return data; + }, + { + enabled: hasAccess, + }, + ); };