From 467069c89887f64cbc6cb44b3766746265fa1db0 Mon Sep 17 00:00:00 2001 From: sam Date: Mon, 11 Sep 2023 15:48:48 +0200 Subject: [PATCH] fix(frontend): make fediverse login modals forms (fixes #97) --- frontend/src/routes/auth/login/+page.svelte | 46 ++++++++++--------- .../src/routes/settings/auth/+page.svelte | 32 +++++++------ 2 files changed, 43 insertions(+), 35 deletions(-) diff --git a/frontend/src/routes/auth/login/+page.svelte b/frontend/src/routes/auth/login/+page.svelte index 528f7c0..f66112f 100644 --- a/frontend/src/routes/auth/login/+page.svelte +++ b/frontend/src/routes/auth/login/+page.svelte @@ -34,7 +34,9 @@ } }); - const fediLogin = async () => { + const fediLogin = async (e: Event) => { + e.preventDefault(); + fediDisabled = true; try { const resp = await apiFetch<{ url: string }>( @@ -71,26 +73,28 @@ {/if} - - -

- This should be the domain you use to access - posts. For example, if your username is @timmie@mastodon.example, but your - user page is at - social.mastodon.example/timmie, you should fill in - social.mastodon.example. -

- {#if error} -
- -
- {/if} -
- - - +
fediLogin(e)}> + + +

+ This should be the domain you use to + access posts. For example, if your username is @timmie@mastodon.example, + but your user page is at + social.mastodon.example/timmie, you should fill in + social.mastodon.example. +

+ {#if error} +
+ +
+ {/if} +
+ + + +

By signing in, you consent to pronouns.cc storing diff --git a/frontend/src/routes/settings/auth/+page.svelte b/frontend/src/routes/settings/auth/+page.svelte index 7c10704..2d03bb5 100644 --- a/frontend/src/routes/settings/auth/+page.svelte +++ b/frontend/src/routes/settings/auth/+page.svelte @@ -44,7 +44,9 @@ let googleUnlinkModalOpen = false; let toggleGoogleUnlinkModal = () => (googleUnlinkModalOpen = !googleUnlinkModalOpen); - const fediLogin = async () => { + const fediLogin = async (e: Event) => { + e.preventDefault(); + fediDisabled = true; try { const resp = await apiFetch<{ url: string }>( @@ -205,19 +207,21 @@ {/if} - - - {#if error} -

- -
- {/if} - - - - +
fediLogin(e)}> + + + {#if error} +
+ +
+ {/if} +
+ + + +