|
14 | 14 | </script> |
15 | 15 |
|
16 | 16 | <LayoutWrapper> |
17 | | - <form |
18 | | - class="flex justify-center w-full" |
19 | | - method="POST" |
20 | | - action="?/login" |
21 | | - use:enhance={async ({ action, cancel, controller, data, form }) => { |
22 | | - // `form` is the `<form>` element |
23 | | - // `data` is its `FormData` object |
24 | | - // `action` is the URL to which the form is posted |
25 | | - // `cancel()` will prevent the submission |
| 17 | + <section class="bcu-card flex flex-col gap-4 p-4"> |
| 18 | + <form |
| 19 | + class="flex justify-center w-full" |
| 20 | + method="POST" |
| 21 | + action="?/login" |
| 22 | + use:enhance={async ({ action, cancel, controller, data, form }) => { |
| 23 | + // `form` is the `<form>` element |
| 24 | + // `data` is its `FormData` object |
| 25 | + // `action` is the URL to which the form is posted |
| 26 | + // `cancel()` will prevent the submission |
26 | 27 |
|
27 | | - const email = `${data.get('email')}`; |
28 | | - const password = `${data.get('password')}`; |
| 28 | + const email = `${data.get('email')}`; |
| 29 | + const password = `${data.get('password')}`; |
29 | 30 |
|
30 | | - if (!email || !password) { |
31 | | - toastStore.trigger({ |
32 | | - message: 'Please Provide Username and Password.' |
33 | | - }); |
34 | | - cancel(); |
35 | | - } else { |
36 | | - try { |
37 | | - await ccdSignInWithEmailAndPassword({ email, password }); |
38 | | - } catch (err) { |
39 | | - if (err instanceof Error) { |
40 | | - toastStore.trigger({ |
41 | | - message: err.message, |
42 | | - background: 'variant-filled-error' |
43 | | - }); |
| 31 | + if (!email || !password) { |
| 32 | + toastStore.trigger({ |
| 33 | + message: 'Please Provide Username and Password.' |
| 34 | + }); |
| 35 | + cancel(); |
| 36 | + } else { |
| 37 | + try { |
| 38 | + await ccdSignInWithEmailAndPassword({ email, password }); |
| 39 | + } catch (err) { |
| 40 | + if (err instanceof Error) { |
| 41 | + toastStore.trigger({ |
| 42 | + message: err.message, |
| 43 | + background: 'variant-filled-error' |
| 44 | + }); |
| 45 | + } |
44 | 46 | } |
45 | 47 | } |
46 | | - } |
47 | 48 |
|
48 | | - return async ({ result, update }) => { |
49 | | - // `result` is an `ActionResult` object |
50 | | - // `update` is a function which triggers the logic that would be triggered if this callback wasn't set |
| 49 | + return async ({ result, update }) => { |
| 50 | + // `result` is an `ActionResult` object |
| 51 | + // `update` is a function which triggers the logic that would be triggered if this callback wasn't set |
51 | 52 |
|
52 | | - update(); |
53 | | - }; |
54 | | - }} |
55 | | - > |
56 | | - <div class="flex flex-col gap-4 p-4 bcu-card text-token"> |
57 | | - <label class="label"> |
58 | | - <span>Email</span> |
59 | | - <input class="input" name="email" type="email" placeholder="codercatdev" /> |
60 | | - </label> |
61 | | - <label class="label"> |
62 | | - <span>Password</span> |
63 | | - <input class="input" name="password" type="password" placeholder="****" /> |
64 | | - </label> |
65 | | - <button class="bcu-button variant-filled-primary" type="submit">Login</button> |
66 | | - <GoogleAuth /> |
67 | | - </div> |
68 | | - </form> |
| 53 | + update(); |
| 54 | + }; |
| 55 | + }} |
| 56 | + > |
| 57 | + <div class="flex flex-col gap-4 text-token"> |
| 58 | + <label class="label"> |
| 59 | + <span>Email</span> |
| 60 | + <input class="input" name="email" type="email" placeholder="codercatdev" /> |
| 61 | + </label> |
| 62 | + <label class="label"> |
| 63 | + <span>Password</span> |
| 64 | + <input class="input" name="password" type="password" placeholder="****" /> |
| 65 | + </label> |
| 66 | + <button class="bcu-button variant-filled-primary" type="submit">Login</button> |
| 67 | + </div> |
| 68 | + </form> |
| 69 | + |
| 70 | + <hr /> |
| 71 | + |
| 72 | + <GoogleAuth /> |
| 73 | + </section> |
69 | 74 | </LayoutWrapper> |
0 commit comments