blob: 075d8728cc791cc5eea6a426499dd986334c19fc (
plain) (
tree)
|
|
<script lang="ts">
import type { AddWorldInput } from '$gql/graphql';
import { addWorld } from '$gql/Mutations';
import Dialog from '$lib/components/Dialog.svelte';
import WorldForm from '$lib/forms/WorldForm.svelte';
import { toastFinally } from '$lib/Toasts';
import { getContextClient } from '@urql/svelte';
import type { ModalProps } from 'svelte-modals';
const client = getContextClient();
let modal: ModalProps = $props();
const initial = { name: '' };
function submit(input: AddWorldInput) {
addWorld(client, { input }).then(modal.close).catch(toastFinally);
}
</script>
<Dialog title="Add World" {...modal}>
<WorldForm {initial} {submit} />
</Dialog>
|