mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
Add explaining comments
This commit is contained in:
parent
f718034f2b
commit
1f139f17e9
@ -30,6 +30,7 @@ export class ForcedLogoutViewModel extends ViewModel<SegmentType, Options> {
|
|||||||
constructor(options: Options) {
|
constructor(options: Options) {
|
||||||
super(options);
|
super(options);
|
||||||
this._sessionId = options.sessionId;
|
this._sessionId = options.sessionId;
|
||||||
|
// Start the logout process immediately without any user interaction
|
||||||
this._logoutPromise = this.forceLogout();
|
this._logoutPromise = this.forceLogout();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,6 +41,7 @@ export class ForcedLogoutViewModel extends ViewModel<SegmentType, Options> {
|
|||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
this._error = err;
|
this._error = err;
|
||||||
|
// Show the error in the UI
|
||||||
this._showSpinner = false;
|
this._showSpinner = false;
|
||||||
this._showStatus = true;
|
this._showStatus = true;
|
||||||
this.emitChange("error");
|
this.emitChange("error");
|
||||||
@ -47,10 +49,15 @@ export class ForcedLogoutViewModel extends ViewModel<SegmentType, Options> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async proceed(): Promise<void> {
|
async proceed(): Promise<void> {
|
||||||
|
/**
|
||||||
|
* The logout should already be completed because we started it from the ctor.
|
||||||
|
* In case the logout is still proceeding, we will show a message with a spinner.
|
||||||
|
*/
|
||||||
this._showSpinner = true;
|
this._showSpinner = true;
|
||||||
this._showStatus = true;
|
this._showStatus = true;
|
||||||
this.emitChange("showStatus");
|
this.emitChange("showStatus");
|
||||||
await this._logoutPromise;
|
await this._logoutPromise;
|
||||||
|
// At this point, the logout is completed for sure.
|
||||||
if (!this._error) {
|
if (!this._error) {
|
||||||
this.navigation.push("session", true);
|
this.navigation.push("session", true);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user