diff options
| author | Adam Soltys <[email protected]> | 2023-03-21 09:58:45 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-03-21 10:38:31 -0700 |
| commit | dce12a5ccff91bd2b985c9664ca29a4c1a083cf2 (patch) | |
| tree | 9d642a8dff3fad917d01ea5051623c3aca5d0d3d /src/routes/(app)/send | |
| parent | f6de1343310ffca90bed4ffe3cf2253b310ddf12 (diff) | |
| download | coinos-ui-dce12a5ccff91bd2b985c9664ca29a4c1a083cf2.tar.gz coinos-ui-dce12a5ccff91bd2b985c9664ca29a4c1a083cf2.zip | |
pin code refactor
Diffstat (limited to 'src/routes/(app)/send')
| -rw-r--r-- | src/routes/(app)/send/+layout.svelte | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/src/routes/(app)/send/+layout.svelte b/src/routes/(app)/send/+layout.svelte index e5c9c051..6192cd40 100644 --- a/src/routes/(app)/send/+layout.svelte +++ b/src/routes/(app)/send/+layout.svelte @@ -8,30 +8,11 @@ export let data; - let loaded; let { user } = data; - - onMount(() => setTimeout(() => (loaded = true), 500)); let cancel = () => goto(`/${user.username}`); - - $: browser && loaded && checkPin($pin); - let checkPin = async (p) => { - if (p?.length !== 6 || p === JSON.parse(sessionStorage.getItem('pin'))) return; - let result; - try { - result = await post('/pin', { pin: p }); - } catch (e) {} - - if (result) { - success('Pin confirmed'); - } else { - fail('Invalid pin'); - $pin = ''; - } - }; </script> -{#if loaded && user.haspin && (!$pin || $pin?.length !== 6)} +{#if user.haspin && (!$pin || $pin?.length !== 6)} <Pin bind:value={$pin} {cancel} /> {/if} |
