fixes linter errors and removes some unneeded async/await

This commit is contained in:
Isaiah Becker-Mayer 2022-07-26 21:05:49 -07:00
parent 8b91d8fac8
commit cadca70946
2 changed files with 13 additions and 13 deletions

View file

@ -58,7 +58,7 @@ export class ViewModel<O extends Options = Options> extends EventEmitter<{change
return this._options[name];
}
observeNavigation(type: string, onChange: (value: string | true | undefined, type: string) => void) {
observeNavigation(type: string, onChange: (value: string | true | undefined, type: string) => void): void {
const segmentObservable = this.navigation.observe(type);
const unsubscribe = segmentObservable.subscribe((value: string | true | undefined) => {
onChange(value, type);
@ -103,7 +103,7 @@ export class ViewModel<O extends Options = Options> extends EventEmitter<{change
//
// translated string should probably always be bindings, unless we're fine with a refresh when changing the language?
// we probably are, if we're using routing with a url, we could just refresh.
i18n(parts: TemplateStringsArray, ...expr: any[]) {
i18n(parts: TemplateStringsArray, ...expr: any[]): string {
// just concat for now
let result = "";
for (let i = 0; i < parts.length; ++i) {

View file

@ -55,7 +55,7 @@ export class LoginViewModel extends ViewModel<Options> {
this._loginToken = loginToken;
this._client = new Client(this.platform);
this._homeserver = defaultHomeserver;
void this._initViewModels();
this._initViewModels();
}
get passwordLoginViewModel(): PasswordLoginViewModel {
@ -98,11 +98,11 @@ export class LoginViewModel extends ViewModel<Options> {
return !!this._abortQueryOperation;
}
goBack() {
goBack(): void {
this.navigation.push("session");
}
async _initViewModels() {
_initViewModels(): void {
if (this._loginToken) {
this._hideHomeserver = true;
this._completeSSOLoginViewModel = this.track(new CompleteSSOLoginViewModel(
@ -115,11 +115,11 @@ export class LoginViewModel extends ViewModel<Options> {
this.emitChange("completeSSOLoginViewModel");
}
else {
await this.queryHomeserver();
void this.queryHomeserver();
}
}
_showPasswordLogin() {
_showPasswordLogin(): void {
this._passwordLoginViewModel = this.track(new PasswordLoginViewModel(
this.childOptions({
loginOptions: this._loginOptions,
@ -128,19 +128,19 @@ export class LoginViewModel extends ViewModel<Options> {
this.emitChange("passwordLoginViewModel");
}
_showSSOLogin() {
_showSSOLogin(): void {
this._startSSOLoginViewModel = this.track(
new StartSSOLoginViewModel(this.childOptions({loginOptions: this._loginOptions}))
);
this.emitChange("startSSOLoginViewModel");
}
_showError(message: string) {
_showError(message: string): void {
this._errorMessage = message;
this.emitChange("errorMessage");
}
_setBusy(status: boolean) {
_setBusy(status: boolean): void {
this._isBusy = status;
this._passwordLoginViewModel?.setBusy(status);
this._startSSOLoginViewModel?.setBusy(status);
@ -193,14 +193,14 @@ export class LoginViewModel extends ViewModel<Options> {
);
}
_disposeViewModels() {
_disposeViewModels(): void {
this._startSSOLoginViewModel = this.disposeTracked(this._startSSOLoginViewModel);
this._passwordLoginViewModel = this.disposeTracked(this._passwordLoginViewModel);
this._completeSSOLoginViewModel = this.disposeTracked(this._completeSSOLoginViewModel);
this.emitChange("disposeViewModels");
}
async setHomeserver(newHomeserver: string): void {
async setHomeserver(newHomeserver: string): Promise<void> {
this._homeserver = newHomeserver;
// clear everything set by queryHomeserver
this._loginOptions = undefined;
@ -226,7 +226,7 @@ export class LoginViewModel extends ViewModel<Options> {
void this.queryHomeserver();
}
async queryHomeserver(): void {
async queryHomeserver(): Promise<void> {
// don't repeat a query we've just done
if (this._homeserver === this._queriedHomeserver || this._homeserver === "") {
return;