Skip to content

Commit

Permalink
Example: ensure middleware pages don't cache
Browse files Browse the repository at this point in the history
  • Loading branch information
fwang committed Dec 29, 2022
1 parent 774eb85 commit bb0635d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions example/pages/middleware-geolocation.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import { useRouter } from "next/router";
import Layout from "../components/layout";

export default function Page() {
export async function getServerSideProps(context) {
return {
props: {
qs: JSON.stringify(context.query),
},
};
}

export default function Page({ qs }) {
return (
<Layout>
<article>
Expand All @@ -11,7 +19,7 @@ export default function Page() {
<hr />
<p>
<b>Test 1:</b>
URL query contains country, city, and region: {JSON.stringify(useRouter().query)}
URL query contains country, city, and region: {qs}
</p>
</article>
</Layout>
Expand Down

0 comments on commit bb0635d

Please sign in to comment.