mirror of
https://github.com/MatrixSeven/file-transfer-go.git
synced 2026-02-23 23:34:46 +08:00
feat: 增加连接错误监听,显示错误信息的 toast 提示
This commit is contained in:
@@ -58,6 +58,14 @@ export const WebRTCTextReceiver: React.FC<WebRTCTextReceiverProps> = ({
|
|||||||
// 是否有任何错误
|
// 是否有任何错误
|
||||||
const hasAnyError = textTransfer.connectionError || fileTransfer.connectionError;
|
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> => {
|
const validatePickupCode = async (code: string): Promise<boolean> => {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user