diff options
| author | Adam Soltys <[email protected]> | 2023-12-07 23:45:20 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-12-07 23:45:20 -0800 |
| commit | 6326608b7e6692e2e47c790ec96126e3975d6a4f (patch) | |
| tree | 6c547432edb1fa2c9e51f0b274847e93c13c2ed0 /src | |
| parent | fdef64da149ed0ceae3778238b9882a576e562ef (diff) | |
| download | coinos-ui-6326608b7e6692e2e47c790ec96126e3975d6a4f.tar.gz coinos-ui-6326608b7e6692e2e47c790ec96126e3975d6a4f.zip | |
wait for loading
Diffstat (limited to 'src')
| -rw-r--r-- | src/routes/(app)/[username]/settings/[...tab]/+page.svelte | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/routes/(app)/[username]/settings/[...tab]/+page.svelte b/src/routes/(app)/[username]/settings/[...tab]/+page.svelte index 03b68973..714ed8db 100644 --- a/src/routes/(app)/[username]/settings/[...tab]/+page.svelte +++ b/src/routes/(app)/[username]/settings/[...tab]/+page.svelte @@ -7,7 +7,7 @@ import Icon from "$comp/Icon.svelte"; import Spinner from "$comp/Spinner.svelte"; import Pin from "$comp/Pin.svelte"; - import { t } from "$lib/translations"; + import { loading, t } from "$lib/translations"; import { fail, auth, post, sleep, warning, success } from "$lib/utils"; import { avatar, banner, password, pin } from "$lib/store"; import { upload } from "$lib/upload"; @@ -58,16 +58,14 @@ $: ({ comp } = tabs.find((t) => t.name === tab)); let { address, id, username } = user; - let loading; + let submitting; - onMount(() => { - if ($page.url.searchParams.get("verified")) - success($t("user.settings.verified")); - }); + $: if (!$loading && $page.url.searchParams.get("verified")) + success($t("user.settings.verified")); async function handleSubmit() { try { - loading = true; + submitting = true; let data = new FormData(formElement); if (data.get("password")) { @@ -95,7 +93,7 @@ mode: "no-cors", }); } catch (e) { - console.log("problem uploading avatar", e); + console.log("problem upsubmitting avatar", e); } } @@ -112,7 +110,7 @@ mode: "no-cors", }); } catch (e) { - console.log("problem uploading banner", e); + console.log("problem upsubmitting banner", e); } } @@ -175,7 +173,7 @@ fail("Something went wrong"); } - loading = false; + submitting = false; } </script> @@ -225,8 +223,8 @@ bind:this={submit} type="submit" class="border-2 border-black rounded-xl font-semibold mx-auto py-3 w-40 hover:opacity-80" - class:bg-black={loading}> - {#if loading} + class:bg-black={submitting}> + {#if submitting} <Spinner /> {:else} <div class="my-auto">{$t("user.settings.saveSettings")}</div> |
