import RootLayout from '@/components/RootLayout'; // next modules import Router, {useRouter} from 'next/router'; import Link from 'next/link'; import {useSession} from 'next-auth/react'; import Image from 'next/image'; // api import {api} from '@/utils/api' // icons import { Trash } from 'grommet-icons'; export default function ReviewPage() { const router = useRouter() const name = router.query.name as string const { status } = useSession() // trpc stuff const {data: bookData} = api.post.getOne.useQuery(name) const deletionMutation = api.post.delete.useMutation() function deleteItem() { if (bookData) { deletionMutation.mutate(bookData.id) Router.replace("/").catch(() => { console.error("Failed to reroute user!") }) } } if (bookData) { return ( {bookData.name} { status == "authenticated" ? : ""} {bookData.reviewContents} ) } else { return ( Well, that's not good.. You've reached a page that doesn't exist. Lets fix that. Head Home ) } }
Well, that's not good..
You've reached a page that doesn't exist. Lets fix that.