Fix toggleBusy

Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
RMidhunSuresh 2021-08-23 15:48:29 +05:30
parent ecfdc314d5
commit 69478b81b2
3 changed files with 10 additions and 12 deletions

View File

@ -116,22 +116,20 @@ export class LoginViewModel extends ViewModel {
this.emitChange("errorMessage"); this.emitChange("errorMessage");
} }
_toggleBusy(status) { _toggleBusy() {
this._isBusy = status; this._isBusy = !this._isBusy;
this._passwordLoginViewModel?.toggleBusy();
this._startSSOLoginViewModel?.toggleBusy();
this.emitChange("isBusy"); this.emitChange("isBusy");
} }
async attemptLogin(loginMethod) { async attemptLogin(loginMethod) {
this._toggleBusy(true); this._toggleBusy();
this._passwordLoginViewModel?.toggleBusy(true);
this._startSSOLoginViewModel?.toggleBusy(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(false); this._toggleBusy();
this._passwordLoginViewModel?.toggleBusy(false);
this._startSSOLoginViewModel?.toggleBusy(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;

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(state) { toggleBusy() {
this._isBusy = state; this._isBusy = !this._isBusy;
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(state) { toggleBusy() {
this._isBusy = state; this._isBusy = !this._isBusy;
this.emitChange("isBusy"); this.emitChange("isBusy");
} }