Refactor room loading components

This commit is contained in:
Robert Long
2022-01-05 15:35:12 -08:00
parent 550c45b69e
commit 0fe38000f5
5 changed files with 191 additions and 170 deletions

View File

@@ -0,0 +1,25 @@
import React from "react";
import { useLoadGroupCall } from "../ConferenceCallManagerHooks";
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);
}