feat: 增加连接错误监听,显示错误信息的 toast 提示

This commit is contained in:
MatrixSeven
2025-08-09 23:25:52 +08:00
parent 4316b28b9f
commit e893ff4e2f

View File

@@ -58,6 +58,14 @@ export const WebRTCTextReceiver: React.FC<WebRTCTextReceiverProps> = ({
// 是否有任何错误
const hasAnyError = textTransfer.connectionError || fileTransfer.connectionError;
// 监听连接错误并显示 toast
useEffect(() => {
if (hasAnyError) {
console.error('[WebRTCTextReceiver] 连接错误:', hasAnyError);
showToast(hasAnyError, 'error');
}
}, [hasAnyError, showToast]);
// 验证取件码是否存在
const validatePickupCode = async (code: string): Promise<boolean> => {
try {