Skip to content

Commit

Permalink
feat: update event API to use EventGroup type for grouped events
Browse files Browse the repository at this point in the history
  • Loading branch information
D3nnis38 committed Dec 9, 2024
1 parent 20b861d commit 1075c65
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/api/event/event.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Event } from 'types/event';
import { Event, EventGroup } from 'types/event';
import { client } from '../baseAxios';

export const getEvents = (filter?: string) => client.get<Event[]>(`/zones/events${filter !== '' ? `?${filter}` : ''}`);
export const getGroupedEvents = (filter?: string) => client.get<Event[][]>(`/zones/events/grouped${filter !== '' ? `?${filter}` : ''}`);
export const getGroupedEvents = (filter?: string) => client.get<EventGroup[]>(`/zones/events/grouped${filter !== '' ? `?${filter}` : ''}`);
export const exportEvents = (filter?: string) => client.get<Blob>(
`/zones/events/export${filter !== '' ? `?${filter}` : ''}`,
{
Expand Down
4 changes: 2 additions & 2 deletions src/modules/Delivery/hooks/useGetEvents/useGetEvents.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { useState } from 'react';
import { Event } from 'types/event';
import { Event, EventGroup } from 'types/event';
import { useEventApi } from 'hooks/useEventApi';
import { downloadBlobAsFile } from 'utils/downloadFile';

export const useGetEvents = () => {
const { getAllEvents, exportAllEvents, getAllGroupedEvents } = useEventApi();
const [events, setEvents] = useState<Event[]>();
const [groupedEvents, setGroupedEvents] = useState<Event[][]>();
const [groupedEvents, setGroupedEvents] = useState<EventGroup[]>();
const [error, setError] = useState<boolean>(false);
const [isLoading, setIsLoading] = useState<boolean>(true);

Expand Down

0 comments on commit 1075c65

Please sign in to comment.