aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-01-21 12:22:59 -0800
committerAdam Soltys <[email protected]>2026-01-21 12:22:59 -0800
commit78867459263ee901e9b8b93ecdffa041a9f78a24 (patch)
tree6ba4b12f27fe486a716c012a70e5a287a8257513
parent9e5f2a72c2e561b14a51f5e1a72f00f9c7799fea (diff)
downloadcoinos-ui-78867459263ee901e9b8b93ecdffa041a9f78a24.tar.gz
coinos-ui-78867459263ee901e9b8b93ecdffa041a9f78a24.zip
remove duplicate login
-rw-r--r--src/routes/(static)/login/+page.svelte35
1 files changed, 11 insertions, 24 deletions
diff --git a/src/routes/(static)/login/+page.svelte b/src/routes/(static)/login/+page.svelte
index 199f3634..f3aa04ef 100644
--- a/src/routes/(static)/login/+page.svelte
+++ b/src/routes/(static)/login/+page.svelte
@@ -66,36 +66,24 @@
});
});
- async function handleSubmit(e) {
- e.preventDefault();
- let data = new FormData(this);
- let user = Object.fromEntries(data);
-
- for (let k in user) {
- data.set(k, user[k]);
- }
-
+ const enhanceLogin = async ({ formData, cancel }) => {
try {
const recaptcha = await getRecaptchaToken();
- data.set("recaptcha", recaptcha);
+ formData.set("recaptcha", recaptcha);
} catch (err) {
fail(err.message || "captcha failed");
+ cancel();
return;
}
- const response = await fetch("?/login", {
- method: "POST",
- body: data,
- });
-
- const result = deserialize(await response.text());
+ return async ({ result }) => {
+ if (result.type === "success") {
+ await invalidateAll();
+ }
- if (result.type === "success") {
- await invalidateAll();
- }
-
- applyAction(result);
- }
+ applyAction(result);
+ };
+ };
$effect(() => {
token?.length === 6 &&
@@ -180,9 +168,8 @@
{/if}
<form
- use:enhance
+ use:enhance={enhanceLogin}
class="space-y-5"
- onsubmit={handleSubmit}
method="POST"
action="?/login"
>