element-call/src/room/GroupCallLoader.jsx

26 lines
539 B
React
Raw Normal View History

2022-01-05 23:35:12 +00:00
import React from "react";
2022-01-06 00:51:24 +00:00
import { useLoadGroupCall } from "./useLoadGroupCall";
2022-01-05 23:35:12 +00:00
import { ErrorView, FullScreenView } from "../FullScreenView";
export function GroupCallLoader({ client, roomId, viaServers, children }) {
const { loading, error, groupCall } = useLoadGroupCall(
client,
roomId,
viaServers
);
if (loading) {
return (
<FullScreenView>
<h1>Loading room...</h1>
</FullScreenView>
);
}
if (error) {
return <ErrorView error={error} />;
}
return children(groupCall);
}