Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | 1x 1x 2x 2x 2x 1x 1x 1x 1x | import { API_ENDPOINTS } from '@repo/constants/endpoints';
import { useApiQueryClients } from '@repo/hooks/useApiClients';
import { useApiDataQuery } from '@repo/hooks/useApiQuery';
export type MeetingRoomItem = {
id: string;
broadcast: string;
};
export type MeetingRoomBookedItem = {
id: string;
category: string;
status: string;
requester: string;
data: {
room: string;
start: string; // ISO 8601 UTC datetime
end: string; // ISO 8601 UTC datetime
note?: string;
};
};
export const QUERY_KEYS = {
MEETING_ROOMS: 'meeting-rooms',
MEETING_ROOMS_BOOKED: 'meeting-rooms-booked',
};
export const useGetMeetingRooms = () => {
const { mainHttp, requestGuard } = useApiQueryClients();
const {
data: meetingRooms,
isLoading,
isError,
} = useApiDataQuery<MeetingRoomItem[]>({
queryKey: [QUERY_KEYS.MEETING_ROOMS],
endpoint: API_ENDPOINTS.MEETING_ROOMS,
httpClient: mainHttp,
requestGuard,
});
return {
meetingRooms: meetingRooms,
isLoadingMeetingRooms: isLoading,
isErrorMeetingRooms: isError,
};
};
export const useMeetingRoomsBooked = () => {
const { mainHttp, requestGuard } = useApiQueryClients();
const {
data: meetingRoomsBooked,
isLoading,
isError,
} = useApiDataQuery<MeetingRoomBookedItem[]>({
queryKey: [QUERY_KEYS.MEETING_ROOMS_BOOKED],
endpoint: API_ENDPOINTS.MEETING_ROOMS_BOOKED,
httpClient: mainHttp,
requestGuard,
});
return {
meetingRoomsBooked: meetingRoomsBooked,
isLoadingMeetingRoomsBooked: isLoading,
isErrorMeetingRoomsBooked: isError,
};
};
|