mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 20:29:06 +00:00
28 lines
745 B
TypeScript
28 lines
745 B
TypeScript
import { useRoomsList } from "../../lib/apiHooks";
|
|
import type { components } from "../../reflector-api";
|
|
|
|
type Page_Room_ = components["schemas"]["Page_RoomDetails_"];
|
|
import { PaginationPage } from "../browse/_components/Pagination";
|
|
|
|
type RoomList = {
|
|
response: Page_Room_ | null;
|
|
loading: boolean;
|
|
error: Error | null;
|
|
refetch: () => void;
|
|
};
|
|
|
|
// Wrapper to maintain backward compatibility
|
|
const useRoomList = (page: PaginationPage): RoomList => {
|
|
const { data, isLoading, error, refetch } = useRoomsList(page);
|
|
return {
|
|
response: data || null,
|
|
loading: isLoading,
|
|
error: error
|
|
? new Error(error.detail ? JSON.stringify(error.detail) : undefined)
|
|
: null,
|
|
refetch,
|
|
};
|
|
};
|
|
|
|
export default useRoomList;
|