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");
}
_toggleBusy(status) {
this._isBusy = status;
_toggleBusy() {
this._isBusy = !this._isBusy;
this._passwordLoginViewModel?.toggleBusy();
this._startSSOLoginViewModel?.toggleBusy();
this.emitChange("isBusy");
}
async attemptLogin(loginMethod) {
this._toggleBusy(true);
this._passwordLoginViewModel?.toggleBusy(true);
this._startSSOLoginViewModel?.toggleBusy(true);
this._toggleBusy();
this._sessionContainer.startWithLogin(loginMethod);
const loadStatus = this._sessionContainer.loadStatus;
const handle = loadStatus.waitFor(status => status !== LoadStatus.Login);
await handle.promise;
this._toggleBusy(false);
this._passwordLoginViewModel?.toggleBusy(false);
this._startSSOLoginViewModel?.toggleBusy(false);
this._toggleBusy();
const status = loadStatus.get();
if (status === LoadStatus.LoginFailed) {
return this._sessionContainer.loginFailure;

View file

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

View file

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