Introduce toasts

This commit is contained in:
Fred Boniface
2024-06-13 21:59:01 +01:00
parent 0d0875f893
commit c93f36102e
11 changed files with 2993 additions and 2861 deletions

View File

@@ -6,6 +6,7 @@
import { checkAuth } from "$lib/libauth";
import LogoutButton from "$lib/navigation/LogoutButton.svelte";
import { getApiUrl } from "$lib/scripts/upstream";
import toast from "svelte-french-toast";
const title = "Register";
@@ -40,6 +41,17 @@
isLoading = false;
}
function send() {
toast.promise(
request(),
{
loading: "Contacting Server...",
success: "Request Answered.",
error: "Unable to contact server."
}
)
}
onMount(async () => {
const auth = await checkAuth();
if (auth.uuidPresent === false) {
@@ -59,7 +71,7 @@
{:else if state == "unreg"}
<p>To register, you will need to enter a work email address to receive a confirmation email</p>
<p class="bold">Already have a registration code? <a href="/more/reg/submit">enter it here</a></p>
<form on:submit={request}>
<form on:submit={send}>
<input type="text" autocomplete="email" placeholder="Enter work email" bind:value={inputValue} on:input={handleInput} /><br />
<label for="checkbox">
I have read and accept the terms of the <a href="/more/privacy">Privacy Policy</a><br />