fix: Close dialog on successful channel creation

This commit is contained in:
April Hall 2025-02-07 11:32:09 -05:00
parent c9a7b77765
commit b69d2d0fef
No known key found for this signature in database
GPG Key ID: A49AC35CB186266C

View File

@ -7,11 +7,18 @@
import type { NewChannelSchema } from '$lib/types/schema';
import { Label } from '$lib/components/ui/label/index';
let open: boolean = $state(false);
let { data }: { data: SuperValidated<Infer<NewChannelSchema>> } = $props();
const { form, errors, constraints, enhance } = superForm(data);
const { form, errors, constraints, enhance } = superForm(data, {
onResult: ({ result }) => {
if (result.type === 'success') {
open = false;
}
},
});
</script>
<Dialog.Root>
<Dialog.Root bind:open>
<Dialog.Trigger class={buttonVariants({ variant: 'secondary' }) + ' w-full'}>Create Channel</Dialog.Trigger>
<Dialog.Content class="sm:max-w-[425px]">
<Dialog.Header>