0
這是我的一個反應本機應用程序與登錄表單分派API調用的代碼。登錄按鈕的事件處理程序將發送apiLogin-Action:Promise.race火災「沒有定義超時」
try {
await Promise.race([
dispatch(actions.doApiLogin(this.state.username, this.state.password)),
timeout(15000),
]);
} catch (e) {
const message = e.message || e;
if (message !== 'Timed out' && message !== 'Canceled by user') {
alert(message);
console.warn(e);
}
return;
} finally {
this._isMounted && this.setState({isLoading: false});
}
它引發異常「超時未定義」。此代碼取自Facebook F8-Application。我無法找到有關Promise.race-Method的詳細信息,這些在互聯網上以這種方式處理,但Facebook上運行着一個應用程序...
傳遞超時有什麼問題?