mirror of https://github.com/MaxLeiter/Drift
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
535 B
TypeScript
32 lines
535 B
TypeScript
import NewPost from "../../components/new"
|
|
import { useRouter } from "next/navigation"
|
|
import Header from "@components/header"
|
|
import { getPostById } from "@lib/server/prisma"
|
|
|
|
const NewFromExisting = async ({
|
|
params
|
|
}: {
|
|
params: {
|
|
id: string
|
|
}
|
|
}) => {
|
|
const { id } = params
|
|
const router = useRouter()
|
|
|
|
if (!id) {
|
|
router.push("/new")
|
|
return;
|
|
}
|
|
|
|
const post = await getPostById(id, true)
|
|
|
|
return (
|
|
<>
|
|
<Header signedIn />
|
|
<NewPost initialPost={post} newPostParent={id} />
|
|
</>
|
|
)
|
|
}
|
|
|
|
export default NewFromExisting
|