mirror of
https://github.com/github/codeql.git
synced 2026-05-01 03:35:13 +02:00
add params, query to test
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
export default function Post({ id, q }) {
|
||||
return (
|
||||
<>
|
||||
<div dangerouslySetInnerHTML={{__html: id }} />
|
||||
<div dangerouslySetInnerHTML={{__html: q }} />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export async function getServerSideProps(context) {
|
||||
return {
|
||||
props: {
|
||||
id: context.params?.id || "",
|
||||
q: context.query?.foobar || "",
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
import type { GetServerSidePropsContext, GetStaticProps, GetStaticPropsContext, InferGetServerSidePropsType, InferGetStaticPropsType, NextPage } from 'next'
|
||||
|
||||
type Props = InferGetServerSidePropsType<typeof getServerSideProps>
|
||||
|
||||
const Home: NextPage<Props> = ({ id, url }) => {
|
||||
return (
|
||||
<>
|
||||
<div dangerouslySetInnerHTML={{__html: url }} />
|
||||
<div dangerouslySetInnerHTML={{__html: id }} />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
export function getServerSideProps(context: GetServerSidePropsContext<{ id: string, url: string }>) {
|
||||
return {
|
||||
props: {
|
||||
id: context.params?.id,
|
||||
url: decodeURIComponent(context.req.url || "")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export default Home
|
||||
Reference in New Issue
Block a user