mirror of
https://github.com/vercel/flags.git
synced 2026-09-19 03:49:23 +08:00
28 lines
752 B
TypeScript
28 lines
752 B
TypeScript
import type { InferGetServerSidePropsType, GetServerSideProps } from 'next';
|
|
import { exampleFlag, hostFlag, cookieFlag } from '../flags';
|
|
|
|
export const getServerSideProps = (async ({ req }) => {
|
|
const example = await exampleFlag(req);
|
|
const host = await hostFlag(req);
|
|
const cookie = await cookieFlag(req);
|
|
return { props: { example, host, cookie } };
|
|
}) satisfies GetServerSideProps<{
|
|
example: boolean;
|
|
host: string;
|
|
cookie: string;
|
|
}>;
|
|
|
|
export default function PagesRouter({
|
|
example,
|
|
host,
|
|
cookie,
|
|
}: InferGetServerSidePropsType<typeof getServerSideProps>) {
|
|
return (
|
|
<div>
|
|
<p>Example Pages Router Flag Value: {example ? 'true' : 'false'}</p>
|
|
<p>Host: {host}</p>
|
|
<p>Cookie: {cookie}</p>
|
|
</div>
|
|
);
|
|
}
|