diff options
| author | Adam Soltys <[email protected]> | 2024-02-22 23:03:29 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-02-22 23:03:29 -0800 |
| commit | 87e5041209e2a2631cbe1a76cf9f07466a066748 (patch) | |
| tree | e68e718299a24615a5552700a1da1e5ccc3fdafb /src/routes/(app)/+layout.svelte | |
| parent | 65e047cf6f7e5537e9e18a366f692affa634e7b9 (diff) | |
| download | coinos-ui-87e5041209e2a2631cbe1a76cf9f07466a066748.tar.gz coinos-ui-87e5041209e2a2631cbe1a76cf9f07466a066748.zip | |
use cookies for pin memory
Diffstat (limited to 'src/routes/(app)/+layout.svelte')
| -rw-r--r-- | src/routes/(app)/+layout.svelte | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/routes/(app)/+layout.svelte b/src/routes/(app)/+layout.svelte index 07f8a2a1..dce7abae 100644 --- a/src/routes/(app)/+layout.svelte +++ b/src/routes/(app)/+layout.svelte @@ -10,6 +10,7 @@ passwordPrompt, password, pin, + user as u, } from "$lib/store"; import { page } from "$app/stores"; import { browser } from "$app/environment"; @@ -17,7 +18,7 @@ import Invoice from "$comp/Invoice.svelte"; import Password from "$comp/Password.svelte"; import Request from "$comp/Request.svelte"; - import { warning, protectedRoutes } from "$lib/utils"; + import { getCookie, warning, protectedRoutes } from "$lib/utils"; import { t, locale, loading } from "$lib/translations"; import { goto, onNavigate } from "$app/navigation"; @@ -39,13 +40,13 @@ $: update(data); let update = (data) => { ({ rate, user, subject, token, rates } = data); + if (browser) $u = user; }; onMount(async () => { if (browser) { checkSocket(); - let locktime = user && user.locktime ? user.locktime : 300; - expireTimer = setTimeout(expirePin, locktime * 1000); + $pin = getCookie('pin'); if (window.NDEFReader && user.nfc) { try { @@ -85,11 +86,6 @@ checkTimer = setTimeout(checkSocket, 1000); }; - let expirePin = () => { - $pin = null; - expireTimer = setTimeout(expirePin, user.locktime * 1000 || 300000); - }; - onDestroy(() => { if (browser) { close(); |
