fix: Move future/workflow/[workflow] getStaticProps into separate file (#16124)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import LegacyPage, { getStaticProps } from "@pages/workflows/[workflow]";
|
||||
import LegacyPage from "@pages/workflows/[workflow]";
|
||||
import { withAppDirSsg } from "app/WithAppDirSsg";
|
||||
import type { PageProps } from "app/_types";
|
||||
import { _generateMetadata } from "app/_utils";
|
||||
@@ -7,6 +7,8 @@ import { headers, cookies } from "next/headers";
|
||||
|
||||
import { buildLegacyCtx } from "@lib/buildLegacyCtx";
|
||||
|
||||
import { getStaticProps } from "~/workflows/workflow-single-view.getStaticProps";
|
||||
|
||||
export const generateMetadata = async ({ params, searchParams }: PageProps) => {
|
||||
const { workflow } = await getData(buildLegacyCtx(headers(), cookies(), params, searchParams));
|
||||
return await _generateMetadata(
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import type { GetStaticProps } from "next";
|
||||
import { z } from "zod";
|
||||
|
||||
const querySchema = z.object({
|
||||
workflow: z.string(),
|
||||
});
|
||||
|
||||
export const getStaticProps: GetStaticProps = (ctx) => {
|
||||
const params = querySchema.safeParse(ctx.params);
|
||||
console.log("Built workflow page:", params);
|
||||
if (!params.success) return { notFound: true };
|
||||
|
||||
return {
|
||||
props: {
|
||||
workflow: params.data.workflow,
|
||||
},
|
||||
revalidate: 10, // seconds
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user