removes unnecessary awaits
This commit is contained in:
parent
aeed978789
commit
a5b9cb6b95
1 changed files with 10 additions and 10 deletions
|
@ -147,9 +147,9 @@ export class LoginViewModel extends ViewModel<Options> {
|
||||||
this.emitChange("isBusy");
|
this.emitChange("isBusy");
|
||||||
}
|
}
|
||||||
|
|
||||||
async attemptLogin(loginMethod: ILoginMethod) {
|
async attemptLogin(loginMethod: ILoginMethod): Promise<null> {
|
||||||
this._setBusy(true);
|
this._setBusy(true);
|
||||||
await this._client.startWithLogin(loginMethod, {inspectAccountSetup: true});
|
void this._client.startWithLogin(loginMethod, {inspectAccountSetup: true});
|
||||||
const loadStatus = this._client.loadStatus;
|
const loadStatus = this._client.loadStatus;
|
||||||
const handle = loadStatus.waitFor((status: LoadStatus) => status !== LoadStatus.Login);
|
const handle = loadStatus.waitFor((status: LoadStatus) => status !== LoadStatus.Login);
|
||||||
await handle.promise;
|
await handle.promise;
|
||||||
|
@ -161,11 +161,11 @@ export class LoginViewModel extends ViewModel<Options> {
|
||||||
this._hideHomeserver = true;
|
this._hideHomeserver = true;
|
||||||
this.emitChange("hideHomeserver");
|
this.emitChange("hideHomeserver");
|
||||||
this._disposeViewModels();
|
this._disposeViewModels();
|
||||||
await this._createLoadViewModel();
|
void this._createLoadViewModel();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
async _createLoadViewModel() {
|
_createLoadViewModel(): void {
|
||||||
this._loadViewModelSubscription = this.disposeTracked(this._loadViewModelSubscription);
|
this._loadViewModelSubscription = this.disposeTracked(this._loadViewModelSubscription);
|
||||||
this._loadViewModel = this.disposeTracked(this._loadViewModel);
|
this._loadViewModel = this.disposeTracked(this._loadViewModel);
|
||||||
this._loadViewModel = this.track(
|
this._loadViewModel = this.track(
|
||||||
|
@ -181,7 +181,7 @@ export class LoginViewModel extends ViewModel<Options> {
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
await this._loadViewModel.start();
|
void this._loadViewModel.start();
|
||||||
this.emitChange("loadViewModel");
|
this.emitChange("loadViewModel");
|
||||||
this._loadViewModelSubscription = this.track(
|
this._loadViewModelSubscription = this.track(
|
||||||
this._loadViewModel.disposableOn("change", () => {
|
this._loadViewModel.disposableOn("change", () => {
|
||||||
|
@ -200,7 +200,7 @@ export class LoginViewModel extends ViewModel<Options> {
|
||||||
this.emitChange("disposeViewModels");
|
this.emitChange("disposeViewModels");
|
||||||
}
|
}
|
||||||
|
|
||||||
async setHomeserver(newHomeserver: string) {
|
async setHomeserver(newHomeserver: string): void {
|
||||||
this._homeserver = newHomeserver;
|
this._homeserver = newHomeserver;
|
||||||
// clear everything set by queryHomeserver
|
// clear everything set by queryHomeserver
|
||||||
this._loginOptions = undefined;
|
this._loginOptions = undefined;
|
||||||
|
@ -223,10 +223,10 @@ export class LoginViewModel extends ViewModel<Options> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this._abortHomeserverQueryTimeout = this.disposeTracked(this._abortHomeserverQueryTimeout);
|
this._abortHomeserverQueryTimeout = this.disposeTracked(this._abortHomeserverQueryTimeout);
|
||||||
await this.queryHomeserver();
|
void this.queryHomeserver();
|
||||||
}
|
}
|
||||||
|
|
||||||
async queryHomeserver() {
|
async queryHomeserver(): void {
|
||||||
// don't repeat a query we've just done
|
// don't repeat a query we've just done
|
||||||
if (this._homeserver === this._queriedHomeserver || this._homeserver === "") {
|
if (this._homeserver === this._queriedHomeserver || this._homeserver === "") {
|
||||||
return;
|
return;
|
||||||
|
@ -270,12 +270,12 @@ export class LoginViewModel extends ViewModel<Options> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async dispose() {
|
dispose(): void {
|
||||||
super.dispose();
|
super.dispose();
|
||||||
if (this._client) {
|
if (this._client) {
|
||||||
// if we move away before we're done with initial sync
|
// if we move away before we're done with initial sync
|
||||||
// delete the session
|
// delete the session
|
||||||
await this._client.deleteSession();
|
void this._client.deleteSession();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue