feat: use last community in community form

This commit is contained in:
Xyphyn committed 2023-08-08 15:21:25 -07:00
1 parent d22d9b09fd
commit 6c7073fcfc
6 files changed
+70 -10

No files matched your search

+9 -1
View File
@@ -4,12 +4,17 @@
import Card from '$lib/components/ui/Card.svelte'
import { profile } from '$lib/auth.js'
import { onMount } from 'svelte'
import { getSessionStorage } from '$lib/session.js'
onMount(() => {
if (!$profile?.jwt) {
goto('/login')
}
})
let community = getSessionStorage('lastSeenCommunity') as
| { id: number; name: string }
| undefined
</script>
<svelte:head>
@@ -17,5 +22,8 @@
</svelte:head>
<Card class="p-6 max-w-2xl mx-auto">
<PostForm on:submit={(e) => goto(`/post/${e.detail.post.id}`)} />
<PostForm
passedCommunity={community}
on:submit={(e) => goto(`/post/${e.detail.post.id}`)}
/>
</Card>