Skip to content

Commit

Permalink
feat: Add button to "delete" account data
Browse files Browse the repository at this point in the history
Signed-off-by: Colton Wolkins (Laptop) <colton@indicio.tech>
  • Loading branch information
TheTechmage committed Apr 2, 2024
1 parent fdbc4e6 commit 10fd194
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/app/wyvern/lib/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,14 @@ export class Agent {
localStorage.setItem("wyvrn-secrets", JSON.stringify(Object.values(secrets)))
}

public DEVELOPER_clearDataBase() {
const request = indexedDB.deleteDatabase("MyTestDatabase");
localStorage.removeItem("wyvrn-did");
localStorage.removeItem("wyvrn-relayed-did");
localStorage.removeItem("wyvrn-secrets");
localStorage.removeItem("profile");
}

private handleWorkerMessage(e: MessageEvent<WorkerMessage<any>>) {
console.log("Agent received message: ", e.data.type)
switch (e.data.type) {
Expand Down
8 changes: 8 additions & 0 deletions src/app/wyvern/server-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ function SettingsMenu() {
onUpdateDisplayName();
onCloseModal();
}
function onDelete(event) {
agent.DEVELOPER_clearDataBase();
onCloseModal();
location.reload();
}

return (
<>
Expand Down Expand Up @@ -158,6 +163,9 @@ function SettingsMenu() {
<div className="w-full">
<Button onClick={onSave} disabled={!validName}>Update Settings</Button>
</div>
<div className="w-full">
<Button className="w-full bg-red-600 enabled:hover:bg-red-950 enabled:hover:text-slate-100 dark:bg-red-950 dark:text-slate-100 dark:enabled:hover:bg-red-600 dark:enabled:hover:text-white-900" onClick={onDelete}>Dev: Delete Local Data!</Button>
</div>
</div>
</Modal.Body>
</Modal>
Expand Down

0 comments on commit 10fd194

Please sign in to comment.