Refactor confirm to avoid passing closures

This commit is contained in:
Jon Staab
2025-02-18 09:03:10 -08:00
parent c40e8ce1a7
commit 08d8d45ecb
8 changed files with 69 additions and 39 deletions
@@ -0,0 +1,21 @@
<script lang="ts">
import Confirm from "@lib/components/Confirm.svelte"
import {publishDelete} from "@app/commands"
import {clearModals} from "@app/modal"
const {url, event} = $props()
const confirm = async () => {
const snapshot = $state.snapshot(event)
await publishDelete({event: snapshot, relays: [url]})
clearModals()
}
</script>
<Confirm
{confirm}
title="Delete Message"
subtitle="Are you sure you want to delete this message?"
message="This will send a request to delete this message. Be aware that not all relays may honor this request." />