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,27 @@
import * as Sentry from "@sentry/react";
export function useSentryGroupCallHandler(groupCall) {
useEffect(() => {
function onHangup(call) {
if (call.hangupReason === "ice_failed") {
Sentry.captureException(new Error("Call hangup due to ICE failure."));
}
}
function onError(error) {
Sentry.captureException(error);
}
if (groupCall) {
groupCall.on("hangup", onHangup);
groupCall.on("error", onError);
}
return () => {
if (groupCall) {
groupCall.removeListener("hangup", onHangup);
groupCall.removeListener("error", onError);
}
};
}, [groupCall]);
}