Skip to content

Instantly share code, notes, and snippets.

@Aanya9693
Created December 26, 2023 10:29
Show Gist options
  • Save Aanya9693/7eb6c1f3c03727ec173c20c906376268 to your computer and use it in GitHub Desktop.
Save Aanya9693/7eb6c1f3c03727ec173c20c906376268 to your computer and use it in GitHub Desktop.
$: if ($message?.status == "success" && $message.content) {
toast.success($message.content, {
position: "top-right",
});
} else if ($message?.status == "failed" && $message.content) {
toast.error("Error occuured while submitting form! Try again.", {
position: "top-right",
});
}
<form
method="POST"
class="flex flex-col w-full"
action="?/send"
use:enhance
>
<div class="h-full mt-8 px-12 text-[14px] text-[#FFF]">
<button
htmlType="submit"
class="text-md font-semibold whitespace-nowrap py-3 rounded text-center w-full bg-primary text-primary-dark {buttondisabled ? 'bg-white': 'bg-primary'} "
on:click={onClickRequest}
disabled={buttondisabled}
>
{#if isLoading}
<div class="flex gap-2 justify-center">
<div class="text-secondary">Requesting</div>
<div class="loading loading-dots" />
</div>
{:else}
Request
{/if}
</button>
{#if form?.success}
<p>Successfully sent!, {data.payerPaymail}</p>
{/if}
</div>
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment