summaryrefslogtreecommitdiffstatshomepage
path: root/frontend/src/lib/toolbar/DeleteSelection.svelte
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/lib/toolbar/DeleteSelection.svelte')
-rw-r--r--frontend/src/lib/toolbar/DeleteSelection.svelte24
1 files changed, 13 insertions, 11 deletions
diff --git a/frontend/src/lib/toolbar/DeleteSelection.svelte b/frontend/src/lib/toolbar/DeleteSelection.svelte
index 7459a87..7b37313 100644
--- a/frontend/src/lib/toolbar/DeleteSelection.svelte
+++ b/frontend/src/lib/toolbar/DeleteSelection.svelte
@@ -1,26 +1,28 @@
<script lang="ts">
import type { DeleteMutation } from '$gql/Mutations';
- import { getSelectionContext } from '$lib/Selection';
+ import DeleteButton from '$lib/components/DeleteButton.svelte';
+ import { getSelectionContext } from '$lib/selection/Selection.svelte';
import { toastFinally } from '$lib/Toasts';
import { confirmDeletion } from '$lib/Utils';
- import DeleteButton from '$lib/components/DeleteButton.svelte';
import { getContextClient } from '@urql/svelte';
const client = getContextClient();
- const selection = getSelectionContext();
- export let mutation: DeleteMutation;
- export let warning: string | undefined = undefined;
+ interface Props {
+ mutation: DeleteMutation;
+ warning?: string;
+ }
+
+ let { mutation, warning = undefined }: Props = $props();
+ let selection = getSelectionContext();
- function remove() {
+ function onclick() {
const mutate = () => {
- mutation(client, { ids: $selection.ids })
- .then(() => ($selection = $selection.clear()))
- .catch(toastFinally);
+ mutation(client, { ids: selection.ids }).then(selection.clear).catch(toastFinally);
};
- confirmDeletion($selection.typename, $selection.names, mutate, warning);
+ confirmDeletion(selection.typename, selection.names, mutate, warning);
}
</script>
-<DeleteButton on:click={remove} />
+<DeleteButton {onclick} />