added call ended to useCallUI

This commit is contained in:
Jon 2021-06-15 17:37:10 +01:00
parent 6166898bfb
commit 7f90489160
1 changed files with 13 additions and 3 deletions

View File

@ -19,6 +19,7 @@ export const useCallUI = ({
room, room,
haircheck, haircheck,
redirectUrl, redirectUrl,
callEnded,
notFoundRedirect = 'not-found', notFoundRedirect = 'not-found',
}) => { }) => {
const router = useRouter(); const router = useRouter();
@ -57,8 +58,9 @@ export const useCallUI = ({
<MessageCard error header="No room component declared" /> <MessageCard error header="No room component declared" />
); );
case CALL_STATE_ENDED: case CALL_STATE_ENDED:
// Note: you could set a manual redirect here but we'll show just an exit screen return callEnded ? (
return ( callEnded()
) : (
<MessageCard onBack={() => window.location.reload()}> <MessageCard onBack={() => window.location.reload()}>
You have left the call. We hope you had fun! You have left the call. We hope you had fun!
</MessageCard> </MessageCard>
@ -72,7 +74,15 @@ export const useCallUI = ({
An unknown error has occured in the call loop. This should not happen! An unknown error has occured in the call loop. This should not happen!
</MessageCard> </MessageCard>
); );
}, [state, notFoundRedirect, redirectUrl, haircheck, room, router]); }, [
state,
notFoundRedirect,
redirectUrl,
haircheck,
room,
callEnded,
router,
]);
return renderByState; return renderByState;
}; };