Skip to content

Commit

Permalink
reload on node clear
Browse files Browse the repository at this point in the history
  • Loading branch information
secondl1ght committed Nov 15, 2023
1 parent c154e70 commit 9493cfd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"repository": "https://github.com/secondl1ght/cipherchat",
"author": "secondl1ght <[email protected]>",
"license": "AGPL-3.0",
"version": "1.0.0",
"version": "1.0.1",
"private": true,
"scripts": {
"dev": "PUBLIC_COMMIT=`git log -n 1 --format=%h` vite dev",
Expand Down
17 changes: 8 additions & 9 deletions src/components/Login.svelte
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<script lang="ts">
import { clearBadge } from '$lib/chat';
import { generateKey, resetKey } from '$lib/crypto';
import { generateKey } from '$lib/crypto';
import { db } from '$lib/db';
import { connected, firstUpdate, lnc, paired } from '$lib/store';
import { errorToast, monthAgo, shortenPubkey, successToast } from '$lib/utils';
import { connected, firstUpdate, lnc } from '$lib/store';
import { errorToast, shortenPubkey } from '$lib/utils';
import { Button, Icon, MessageHistory } from 'comp';
let loading = false;
let clearing = false;
let password = '';
let showPass = false;
Expand Down Expand Up @@ -47,22 +48,20 @@
const clear = async () => {
try {
clearing = true;
loading = true;
await db.delete();
localStorage.clear();
await clearBadge();
$lnc.credentials.clear();
resetKey();
$firstUpdate = monthAgo();
$paired = false;
successToast('Node credentials cleared.');
location.reload();
} catch (error) {
console.log(error);
errorToast('Clear connection failed, please try again.');
} finally {
loading = false;
clearing = false;
}
};
</script>
Expand Down Expand Up @@ -127,7 +126,7 @@
title="Login"
disabled={loading || !password || !$firstUpdate}
{loading}
loadingText="Logging in..."
loadingText={clearing ? 'Clearing...' : 'Logging in...'}
/>

<div class="flex justify-center">
Expand Down

0 comments on commit 9493cfd

Please sign in to comment.