diff options
| author | Adam Soltys <[email protected]> | 2024-09-24 21:00:38 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-09-24 21:00:38 -0700 |
| commit | 840c15e43f721cf44059bc53a1d58603af80649c (patch) | |
| tree | b643e07b4dc89e8bd3909cccb15933e6b2964ed6 /src | |
| parent | d3ea62f55d3effc8ad34b0129d0a4188ec4b768f (diff) | |
| download | coinos-ui-840c15e43f721cf44059bc53a1d58603af80649c.tar.gz coinos-ui-840c15e43f721cf44059bc53a1d58603af80649c.zip | |
post to server endpoint
Diffstat (limited to 'src')
| -rw-r--r-- | src/routes/(app)/account/+server.ts | 12 | ||||
| -rw-r--r-- | src/routes/(app)/account/pass/+page.svelte | 2 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/routes/(app)/account/+server.ts b/src/routes/(app)/account/+server.ts new file mode 100644 index 00000000..bcf73ac8 --- /dev/null +++ b/src/routes/(app)/account/+server.ts @@ -0,0 +1,12 @@ +import { auth, post } from "$lib/utils"; +import { error, json } from "@sveltejs/kit"; + +export async function POST({ cookies, request }) { + try { + let body = await request.json(); + return json(await post(`/accounts`, body, auth(cookies))); + } catch (e: any) { + console.log(e); + error(500, e.message); + } +} diff --git a/src/routes/(app)/account/pass/+page.svelte b/src/routes/(app)/account/pass/+page.svelte index 77298cc4..5b94a756 100644 --- a/src/routes/(app)/account/pass/+page.svelte +++ b/src/routes/(app)/account/pass/+page.svelte @@ -44,7 +44,7 @@ let child = master.derive("m/84'/0'/0'"); let pubkey = child.publicExtendedKey; let fingerprint = child.fingerprint.toString(16).padStart(8, "0"); - await post("/api/accounts", { fingerprint, pubkey, name, seed, type }); + await post("/account", { fingerprint, pubkey, name, seed, type }); goto(`/${user.username}`); } catch (e) { console.log(e); |
