mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-22 19:14:52 +01:00
resetStatus from within startLogin
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
parent
9482998b15
commit
c650b35831
@ -59,7 +59,6 @@ export class CompleteSSOLoginViewModel extends ViewModel {
|
||||
}
|
||||
if (error) {
|
||||
this._showError(error);
|
||||
this._sessionContainer.resetStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,6 @@ export class LoginViewModel extends ViewModel {
|
||||
_showPasswordLogin() {
|
||||
this._passwordLoginViewModel = this.track(new PasswordLoginViewModel(
|
||||
this.childOptions({
|
||||
sessionContainer: this._sessionContainer,
|
||||
loginOptions: this._loginOptions,
|
||||
homeserver: this._homeserver,
|
||||
attemptLogin: loginMethod => this.attemptLogin(loginMethod),
|
||||
|
@ -20,8 +20,7 @@ import {LoginFailure} from "../../matrix/SessionContainer.js";
|
||||
export class PasswordLoginViewModel extends ViewModel {
|
||||
constructor(options) {
|
||||
super(options);
|
||||
const {loginOptions, sessionContainer, homeserver, attemptLogin, showError} = options;
|
||||
this._sessionContainer = sessionContainer;
|
||||
const {loginOptions, homeserver, attemptLogin, showError} = options;
|
||||
this._loginOptions = loginOptions;
|
||||
this._attemptLogin = attemptLogin;
|
||||
this._showError = showError;
|
||||
@ -54,7 +53,6 @@ export class PasswordLoginViewModel extends ViewModel {
|
||||
}
|
||||
if (error) {
|
||||
this._showError(error);
|
||||
this._sessionContainer.resetStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -129,9 +129,11 @@ export class SessionContainer {
|
||||
}
|
||||
|
||||
async startWithLogin(loginMethod) {
|
||||
if (this._status.get() !== LoadStatus.NotLoading) {
|
||||
const currentStatus = this._status.get();
|
||||
if (currentStatus !== LoadStatus.LoginFailed && currentStatus !== LoadStatus.NotLoading) {
|
||||
return;
|
||||
}
|
||||
this._resetStatus();
|
||||
await this._platform.logger.run("login", async log => {
|
||||
this._status.set(LoadStatus.Login);
|
||||
const clock = this._platform.clock;
|
||||
@ -354,7 +356,7 @@ export class SessionContainer {
|
||||
}
|
||||
}
|
||||
|
||||
resetStatus() {
|
||||
_resetStatus() {
|
||||
this._status.set(LoadStatus.NotLoading);
|
||||
this._error = null;
|
||||
this._loginFailure = null;
|
||||
|
Loading…
Reference in New Issue
Block a user