import type { GetServerSideProps } from "next"; import Head from "next/head"; import { AreaRiservataLayout } from "~/components/Layout"; import { LoadingPage } from "~/components/loading"; import { Status500 } from "~/components/status-page"; import { OrdiniTable } from "~/components/tables/orders-table"; import type { NextPageWithLayout } from "~/pages/_app"; import { useTranslation } from "~/providers/I18nProvider"; import { useEnforcedSession } from "~/providers/SessionProvider"; import type { UsersId } from "~/schemas/public/Users"; import { TrpcAuthedFetchingIstance } from "~/server/utils/ssgHelper"; import { api } from "~/utils/api"; const Ordini: NextPageWithLayout = () => { const { t } = useTranslation(); const session = useEnforcedSession(); return ( <> {t.heads.area_riservata_titolo} ); }; export default Ordini; export const getServerSideProps = (async (context) => { const access_token = context.req.cookies.access_token; const helpers = await TrpcAuthedFetchingIstance({ access_token }); if (helpers) { await helpers.trpc.servizio.getOrdini.prefetch({}); return { props: { trpcState: helpers.trpc.dehydrate(), }, }; } return { props: {}, }; }) satisfies GetServerSideProps; const SessionWrapper = ({ userId }: { userId: UsersId }) => { const { data, isLoading } = api.servizio.getOrdini.useQuery({ userId, }); if (isLoading) return ; if (!data) return ; return (

Ordini

); }; Ordini.getLayout = function getLayout(page) { return {page}; };