CoastalCommitsPastes/client/app/(posts)/new/from/[id]/page.tsx

32 lines
552 B
TypeScript
Raw Normal View History

2022-11-12 03:58:21 -05:00
import NewPost from "app/(posts)/new/components/new"
import { useRouter } from "next/navigation"
import { getPostWithFiles } from "@lib/server/prisma"
2022-11-12 03:58:21 -05:00
import Header from "app/components/header"
2022-11-10 02:11:36 -05:00
const NewFromExisting = async ({
params
}: {
params: {
id: string
}
}) => {
const { id } = params
const router = useRouter()
if (!id) {
router.push("/new")
return;
}
const post = await getPostWithFiles(id)
return (
<>
<Header signedIn />
<NewPost initialPost={post} newPostParent={id} />
</>
)
2022-11-09 21:38:05 -05:00
}
export default NewFromExisting