@functionalcms/svelte-components 5.24.0 → 5.24.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@functionalcms/svelte-components",
3
- "version": "5.24.0",
3
+ "version": "5.24.1",
4
4
  "license": "MIT",
5
5
  "watch": {
6
6
  "build": {
@@ -1,7 +1,9 @@
1
1
  <script lang="ts">
2
- import { Button, Input, Label } from "@functionalcms/svelte-components";
2
+ import {
3
+ Button,
4
+ Spinner,
5
+ } from "@functionalcms/svelte-components";
3
6
  import * as m from "$lib/paraglide/messages.js";
4
- import { goto } from "$app/navigation";
5
7
  import { deserialize } from "$app/forms";
6
8
 
7
9
  interface Props {
@@ -12,12 +14,12 @@
12
14
 
13
15
  let { data } = $props();
14
16
 
15
- let password = $state("");
16
- let confirmPassword = $state("");
17
- let submitError = $state(false);
17
+
18
+ let isProcesing = $state(false);
19
+ let resultMessage = $state("");
18
20
 
19
21
  async function resetPassword() {
20
- submitError = false;
22
+ isProcesing = true;
21
23
 
22
24
  const response = await fetch("?/setup", {
23
25
  method: "POST",
@@ -25,6 +27,13 @@
25
27
  });
26
28
 
27
29
  const result = deserialize(await response.text());
30
+
31
+ resultMessage =
32
+ result.type === "success"
33
+ ? m.auth_setup_success()
34
+ : m.auth_setup_failure();
35
+
36
+ isProcesing = false;
28
37
  }
29
38
  </script>
30
39
 
@@ -33,20 +42,22 @@
33
42
  class="flex flex-col justify-around items-center gap-4 w-full m-auto p-4"
34
43
  >
35
44
  <h1>{m.auth_setup_title()}</h1>
36
- {#if !data.code}
37
- <p>{m.auth_setup_missing_code()}</p>
38
- {:else}
39
- <div>
40
- {@html m.auth_setup_into()}
41
- </div>
42
- <Button onclick={resetPassword}>
43
- {m.auth_setup_submit()}
44
- </Button>
45
-
46
- {#if submitError}
47
- <p class="text-red-600">{m.auth_setup_error()}</p>
45
+ {#if !data.code}
46
+ <p>{m.auth_setup_missing_code()}</p>
47
+ {:else}
48
+ <div>
49
+ {@html m.auth_setup_into()}
50
+ </div>
51
+ <Button onclick={resetPassword} disabled={isProcesing}>
52
+ {#if isProcesing}
53
+ <Spinner size="16"/>
48
54
  {/if}
55
+ {m.auth_setup_submit()}
56
+ </Button>
57
+ {#if resultMessage != ""}
58
+ <p>{resultMessage}</p>
49
59
  {/if}
60
+ {/if}
50
61
  </main>
51
62
  </article>
52
63