refactor: if we have an empty key, delete local storage and flag logoutComplete as true
This commit is contained in:
parent
7adc0c4072
commit
22a73737af
|
@ -57,7 +57,12 @@ function handleStorage(event: StorageEvent) {
|
|||
window.addEventListener("storage", handleStorage);
|
||||
|
||||
export function saveUserKey(key: Uint8Array) {
|
||||
if (key.length) {
|
||||
window.localStorage.setItem("key", bytesToHex(key));
|
||||
} else {
|
||||
window.localStorage.removeItem("key");
|
||||
setLogoutComplete(true);
|
||||
}
|
||||
const event = new StorageEvent("storage", {
|
||||
key: "key",
|
||||
});
|
||||
|
|
Reference in New Issue