import React, { useEffect } from "react"; import { useRouter } from "next/router"; import { ArchivedFormat } from "@/types/global"; import ReadableView from "@/components/ReadableView"; import getServerSideProps from "@/lib/client/getServerSideProps"; import { useGetLink } from "@/hooks/store/links"; import clsx from "clsx"; export default function Index() { const getLink = useGetLink(); const router = useRouter(); useEffect(() => { if (router.query.id) { getLink.mutateAsync({ id: Number(router.query.id) }); } }, []); return (
{/*
Readable
*/} {getLink.data?.id && Number(router.query.format) === ArchivedFormat.readability ? ( ) : getLink.data?.id && Number(router.query.format) === ArchivedFormat.monolith ? ( ) : getLink.data?.id && Number(router.query.format) === ArchivedFormat.pdf ? ( ) : getLink.data?.id && Number(router.query.format) === ArchivedFormat.png ? ( ) : getLink.data?.id && Number(router.query.format) === ArchivedFormat.jpeg ? ( ) : getLink.error ? (

404 - Not found

) : (
)}
); } export { getServerSideProps };