Open a finished Rule from its Profile card, and drop it from the browser on Log out.
This commit is contained in:
1 parent
db1599123b
commit
942c7cc9de
17 files changed
+280
-14
No files matched your search
@@ -0,0 +1,24 @@
|
||||
import { clearPendingKeepRuleLogin } from "../../../../lib/create/pendingKeepRuleLogin";
|
||||
import { clearLastPublishedRule } from "../../../../lib/create/lastPublishedRule";
|
||||
import { clearCreateFlowPersistedDrafts } from "./clearCreateFlowPersistedDrafts";
|
||||
|
||||
const LEGACY_LIVE_KEY = "create-flow-state";
|
||||
const LEGACY_DRAFT_KEY = "create-flow-draft";
|
||||
|
||||
/**
|
||||
* Drop every Rule the browser is holding: the anonymous draft, last finished
|
||||
* Rule, keep-this-rule prompt, and leftover pre-anonymous keys. Does not
|
||||
* `DELETE /api/drafts/me`. Call after Log out and Delete account.
|
||||
*/
|
||||
export function clearBrowserRuleData(): void {
|
||||
clearCreateFlowPersistedDrafts();
|
||||
clearLastPublishedRule();
|
||||
clearPendingKeepRuleLogin();
|
||||
if (typeof window === "undefined") return;
|
||||
try {
|
||||
window.localStorage.removeItem(LEGACY_LIVE_KEY);
|
||||
window.localStorage.removeItem(LEGACY_DRAFT_KEY);
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user