Lib: Use progressive form enhancement for all cards
This commit is contained in:
@ -10,6 +10,7 @@
|
||||
import type { Driver, Team } from "$lib/schema";
|
||||
import { DRIVER_HEADSHOT_HEIGHT, DRIVER_HEADSHOT_WIDTH } from "$lib/config";
|
||||
import { team_dropdown_options } from "$lib/dropdown";
|
||||
import { enhance } from "$app/forms";
|
||||
|
||||
interface DriverCardProps {
|
||||
/** The [Driver] object used to prefill values. */
|
||||
@ -71,7 +72,7 @@
|
||||
imgheight={DRIVER_HEADSHOT_HEIGHT}
|
||||
imgonclick={(event: Event) => modalStore.close()}
|
||||
>
|
||||
<form method="POST" enctype="multipart/form-data">
|
||||
<form method="POST" enctype="multipart/form-data" use:enhance>
|
||||
<!-- This is also disabled, because the ID should only be -->
|
||||
<!-- "leaked" to users that are allowed to use the inputs -->
|
||||
{#if driver && !disable_inputs}
|
||||
@ -158,6 +159,7 @@
|
||||
disabled={disable_inputs}
|
||||
submit
|
||||
width="w-1/2"
|
||||
onclick={() => modalStore.close()}
|
||||
>
|
||||
Save
|
||||
</Button>
|
||||
@ -167,6 +169,7 @@
|
||||
disabled={disable_inputs}
|
||||
formaction="?/delete_driver"
|
||||
width="w-1/2"
|
||||
onclick={() => modalStore.close()}
|
||||
>
|
||||
Delete
|
||||
</Button>
|
||||
@ -177,6 +180,7 @@
|
||||
submit
|
||||
width="w-full"
|
||||
disabled={disable_inputs}
|
||||
onclick={() => modalStore.close()}
|
||||
>
|
||||
Create Driver
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user