mirror of
https://github.com/element-hq/element-web
synced 2024-11-27 03:36:07 +03:00
forgot to remove this
This commit is contained in:
parent
7dc92fe917
commit
a86ca952b3
2 changed files with 0 additions and 37 deletions
|
@ -499,32 +499,3 @@ export function stopMatrixClient() {
|
||||||
MatrixClientPeg.unset();
|
MatrixClientPeg.unset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Clears indexeddb storage and reloads the session
|
|
||||||
* localStorage is preserved.
|
|
||||||
*/
|
|
||||||
export async function flushStorageAndReload() {
|
|
||||||
// gather the credentials from localStorage as
|
|
||||||
// MatrixClient.credentials only contains the userId
|
|
||||||
// (gets cleared somewhere probably)
|
|
||||||
// this just does the reverse of _persistCredentialsToLocalStorage
|
|
||||||
const credentials = {
|
|
||||||
homeserverUrl: localStorage.getItem("mx_hs_url"),
|
|
||||||
identityServerUrl: localStorage.getItem("mx_is_url"),
|
|
||||||
userId: localStorage.getItem("mx_user_id"),
|
|
||||||
accessToken: localStorage.getItem("mx_access_token"),
|
|
||||||
guest: JSON.parse(localStorage.getItem("mx_is_guest")),
|
|
||||||
deviceId: localStorage.getItem("mx_device_id"),
|
|
||||||
};
|
|
||||||
// stop the client so it's not running anymore
|
|
||||||
stopMatrixClient();
|
|
||||||
// create a temporary client to clear out the persistent stores.
|
|
||||||
const cli = createMatrixClient({
|
|
||||||
// we'll never make any requests, so can pass a bogus HS URL
|
|
||||||
baseUrl: "",
|
|
||||||
});
|
|
||||||
// clear indexeddb
|
|
||||||
await cli.clearStores();
|
|
||||||
// start the session again without clearing storage
|
|
||||||
_doSetLoggedIn(credentials, false);
|
|
||||||
}
|
|
||||||
|
|
|
@ -479,14 +479,6 @@ export default React.createClass({
|
||||||
case 'logout':
|
case 'logout':
|
||||||
Lifecycle.logout();
|
Lifecycle.logout();
|
||||||
break;
|
break;
|
||||||
case 'flush_storage_reload':
|
|
||||||
// flushStorageAndReload will dispatch actions
|
|
||||||
// which we can't do in a dispatch handler
|
|
||||||
// so yield first
|
|
||||||
setTimeout(() => {
|
|
||||||
Lifecycle.flushStorageAndReload();
|
|
||||||
}, 0);
|
|
||||||
break;
|
|
||||||
case 'start_registration':
|
case 'start_registration':
|
||||||
this._startRegistration(payload.params || {});
|
this._startRegistration(payload.params || {});
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue