Rename toggle to set

Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
RMidhunSuresh 2021-08-23 16:09:40 +05:30
parent b0db7e0344
commit fc169af10f
3 changed files with 11 additions and 11 deletions

View file

@ -115,20 +115,20 @@ export class LoginViewModel extends ViewModel {
this.emitChange("errorMessage"); this.emitChange("errorMessage");
} }
_toggleBusy() { _setBusy(status) {
this._isBusy = !this._isBusy; this._isBusy = status;
this._passwordLoginViewModel?.toggleBusy(); this._passwordLoginViewModel?.setBusy(status);
this._startSSOLoginViewModel?.toggleBusy(); this._startSSOLoginViewModel?.setBusy(status);
this.emitChange("isBusy"); this.emitChange("isBusy");
} }
async attemptLogin(loginMethod) { async attemptLogin(loginMethod) {
this._toggleBusy(); this._setBusy(true);
this._sessionContainer.startWithLogin(loginMethod); this._sessionContainer.startWithLogin(loginMethod);
const loadStatus = this._sessionContainer.loadStatus; const loadStatus = this._sessionContainer.loadStatus;
const handle = loadStatus.waitFor(status => status !== LoadStatus.Login); const handle = loadStatus.waitFor(status => status !== LoadStatus.Login);
await handle.promise; await handle.promise;
this._toggleBusy(); this._setBusy(false);
const status = loadStatus.get(); const status = loadStatus.get();
if (status === LoadStatus.LoginFailed) { if (status === LoadStatus.LoginFailed) {
return this._sessionContainer.loginFailure; return this._sessionContainer.loginFailure;
@ -163,7 +163,7 @@ export class LoginViewModel extends ViewModel {
if (!this._loadViewModel.loading) { if (!this._loadViewModel.loading) {
this._loadViewModelSubscription = this.disposeTracked(this._loadViewModelSubscription); this._loadViewModelSubscription = this.disposeTracked(this._loadViewModelSubscription);
} }
this._toggleBusy(false); this._setBusy(false);
}) })
); );
} }

View file

@ -30,8 +30,8 @@ export class PasswordLoginViewModel extends ViewModel {
get isBusy() { return this._isBusy; } get isBusy() { return this._isBusy; }
get errorMessage() { return this._errorMessage; } get errorMessage() { return this._errorMessage; }
toggleBusy() { setBusy(status) {
this._isBusy = !this._isBusy; this._isBusy = status;
this.emitChange("isBusy"); this.emitChange("isBusy");
} }

View file

@ -25,8 +25,8 @@ export class StartSSOLoginViewModel extends ViewModel{
get isBusy() { return this._isBusy; } get isBusy() { return this._isBusy; }
toggleBusy() { setBusy(status) {
this._isBusy = !this._isBusy; this._isBusy = status;
this.emitChange("isBusy"); this.emitChange("isBusy");
} }