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,24 @@
<script module lang="ts">
import {goto} from "$app/navigation"
import {makeSpacePath} from "@app/routes"
export const confirmSpaceVisit = (url: string) => {
goto(makeSpacePath(url), {replaceState: true})
}
</script>
<script lang="ts">
import Confirm from "@lib/components/Confirm.svelte"
type Props = {
url: string
}
const {url}: Props = $props()
const confirm = () => confirmSpaceVisit(url)
</script>
<Confirm
{confirm}
message="This space does not appear to limit who can post to it. This can result in a large amount of spam or other objectionable content. Continue?" />