Merge pull request #916 from vector-im/bwindels/fix-logout-button-on-load-error

Fix logout not working when there is a session load error
This commit is contained in:
Bruno Windels 2022-11-10 17:26:53 +00:00 committed by GitHub
commit 430464c829
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View File

@ -154,7 +154,7 @@ export class SessionLoadViewModel extends ViewModel {
}
async logout() {
await this._client.logout();
await this._client.startLogout(this.navigation.path.get("session").value);
this.navigation.push("session", true);
}

View File

@ -78,11 +78,15 @@ export class StorageFactory {
return new Storage(db, this._idbFactory, this._IDBKeyRange, hasWebkitEarlyCloseTxnBug, this._localStorage, log.logger);
}
delete(sessionId: string): Promise<IDBDatabase> {
async delete(sessionId: string): Promise<void> {
const databaseName = sessionName(sessionId);
clearKeysFromLocalStorage(this._localStorage, databaseName);
const req = this._idbFactory.deleteDatabase(databaseName);
return reqAsPromise(req);
try {
clearKeysFromLocalStorage(this._localStorage, databaseName);
} catch (e) {}
try {
const req = this._idbFactory.deleteDatabase(databaseName);
await reqAsPromise(req);
} catch (e) {}
}
async export(sessionId: string, log: ILogItem): Promise<Export> {