Skip to content

Commit

Permalink
Implement handleErrorObject
Browse files Browse the repository at this point in the history
  • Loading branch information
vhande committed Nov 22, 2024
1 parent 7a657e8 commit bff49bc
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/hooks/api/organizers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { fetchFromApi, isErrorObject } from '@/utils/fetchFromApi';

import type { Headers } from './types/Headers';
import type { User } from './user';
import { handleErrorObject } from '@/utils/handleErrorObject';

type HeadersAndQueryData = {
headers: Headers;
Expand Down Expand Up @@ -173,17 +174,11 @@ type UseGetOrganizerPermissionsArguments = ServerSideQueryOptions & {
const getOrganizerPermissions = async ({ headers, organizerId }) => {
const res = await fetchFromApi({
path: `/organizers/${organizerId}/permissions`,
options: {
headers,
},
options: { headers },
});
if (isErrorObject(res)) {
// eslint-disable-next-line no-console
return console.error(res);
}
return await res.json();
};

return handleErrorObject(res);
};
const useGetOrganizerPermissions = (
{ req, queryClient, organizerId }: UseGetOrganizerPermissionsArguments,
configuration: UseQueryOptions = {},
Expand Down

0 comments on commit bff49bc

Please sign in to comment.