communication-react-19
Version:
React library for building modern communication user experiences utilizing Azure Communication Services (React 19 compatible fork)
28 lines • 1.39 kB
JavaScript
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { useEffect } from 'react';
import { ROOM_NOT_FOUND_SUB_CODE, ROOM_NOT_VALID_SUB_CODE, NOT_INVITED_TO_ROOM_SUB_CODE, INVITE_TO_ROOM_REMOVED_SUB_CODE } from './Utils';
/**
* @private
*/
export const useEndedCallConsoleErrors = (endedCall) => {
var _a;
useEffect(() => {
var _a;
switch ((_a = endedCall === null || endedCall === void 0 ? void 0 : endedCall.callEndReason) === null || _a === void 0 ? void 0 : _a.subCode) {
case ROOM_NOT_FOUND_SUB_CODE:
console.error('Call ended because the room id provided through the adapter locator could not be found');
break;
case ROOM_NOT_VALID_SUB_CODE:
console.error('Call ended because this room is currently not valid.');
break;
case NOT_INVITED_TO_ROOM_SUB_CODE:
console.error('Call ended because you are not invited to this room.');
break;
case INVITE_TO_ROOM_REMOVED_SUB_CODE:
console.error('Call ended because your invite to this room has been removed.');
break;
}
}, [(_a = endedCall === null || endedCall === void 0 ? void 0 : endedCall.callEndReason) === null || _a === void 0 ? void 0 : _a.subCode]);
};
//# sourceMappingURL=useConsoleErrors.js.map