Skip to content

Commit

Permalink
fix: fix api payload parse (#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
PaiJi committed Jun 2, 2024
1 parent 1de47b2 commit 8bc3dcc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
4 changes: 0 additions & 4 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import { GoogleAnalytics } from "@next/third-parties/google";
import { Noto_Sans_SC, Rubik } from "next/font/google";

import Layout from "@/components/layout";

import "@/styles/globals.css";
import type { AppProps } from "next/app";

const isDisableTrack = process.env.ENABLE_TRACK === "false";

const notoSC = Noto_Sans_SC({
weight: ["400", "500", "700"],
subsets: ["latin"],
Expand Down Expand Up @@ -36,7 +33,6 @@ export default function App({ Component, pageProps }: AppProps) {
structuredData={pageProps.structuredData}
>
<Component {...pageProps} />
{!isDisableTrack && <GoogleAnalytics gaId="G-RBND7XQ43D" />}
</Layout>
</>
);
Expand Down
2 changes: 2 additions & 0 deletions src/pages/_document.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { GoogleAnalytics } from "@next/third-parties/google";
import { Html, Head, Main, NextScript } from "next/document";
import Script from "next/script";

Expand Down Expand Up @@ -57,6 +58,7 @@ export default function Document() {
`}
</Script>
)}
{isEnableTrack && <GoogleAnalytics gaId="G-RBND7XQ43D" />}
</body>
</Html>
);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/api/revalidate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default async function handler(
}
const payload = req.body;

const { pathname } = payload;
const { pathname } = JSON.parse(payload);

if (typeof pathname !== "string") {
return res.status(401).json({ message: "Invalid path." });
Expand Down

0 comments on commit 8bc3dcc

Please sign in to comment.