mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
Use async/await
This commit is contained in:
parent
f7f32ac806
commit
28931f4103
@ -68,10 +68,12 @@ class Request implements IHomeServerRequest {
|
|||||||
return this._responseCodePromise;
|
return this._responseCodePromise;
|
||||||
}
|
}
|
||||||
|
|
||||||
setRequestResult(result) {
|
async setRequestResult(result) {
|
||||||
this._requestResult = result;
|
this._requestResult = result;
|
||||||
this._requestResult?.response().then(response => this.responseResolve(response));
|
const response = await this._requestResult?.response();
|
||||||
this._requestResult?.responseCode().then(response => this.responseCodeResolve?.(response));
|
this.responseResolve(response);
|
||||||
|
const responseCode = await this._requestResult?.responseCode();
|
||||||
|
this.responseCodeResolve(responseCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
get requestResult() {
|
get requestResult() {
|
||||||
@ -140,7 +142,7 @@ export class RequestScheduler {
|
|||||||
request.methodName
|
request.methodName
|
||||||
].apply(this._hsApi, request.args);
|
].apply(this._hsApi, request.args);
|
||||||
// so the request can be aborted
|
// so the request can be aborted
|
||||||
request.setRequestResult(requestResult);
|
await request.setRequestResult(requestResult);
|
||||||
return;
|
return;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (
|
if (
|
||||||
|
Loading…
Reference in New Issue
Block a user