Files
photon-tbw/src/routes/create/post/+page.svelte
T

35 lines
902 B
Svelte

<script lang="ts">
import { goto } from '$app/navigation'
import PostForm from '$lib/components/lemmy/post/PostForm.svelte'
import Card from '$lib/components/ui/Card.svelte'
import { profile } from '$lib/auth.js'
import { onMount } from 'svelte'
import { getSessionStorage, setSessionStorage } from '$lib/session.js'
onMount(() => {
if (!$profile?.jwt) {
goto('/login')
}
})
let community = getSessionStorage('lastSeenCommunity') as
| { id: number; name: string }
| undefined
setSessionStorage('lastSeenCommunity', undefined)
</script>
<svelte:head>
<title>Create post</title>
</svelte:head>
<div class="w-full max-w-5xl mx-auto h-full">
<PostForm
passedCommunity={community}
on:submit={(e) => goto(`/post/${e.detail.post.id}`)}
class="mt-auto"
>
<h1 class="text-2xl font-bold" slot="formtitle">Create Post</h1>
</PostForm>
</div>