diff --git a/apps/cms/src/hooks/revalidate-page.ts b/apps/cms/src/hooks/revalidate-page.ts index 1872aa5b..a0f0b4c4 100644 --- a/apps/cms/src/hooks/revalidate-page.ts +++ b/apps/cms/src/hooks/revalidate-page.ts @@ -20,15 +20,17 @@ export const revalidatePage = const revalidate = async (): Promise => { try { const fetchData = JSON.stringify(await getFetchData(doc, req)); - const res = await fetch( - `${ - process.env.PUBLIC_FRONTEND_URL - }/api/revalidate?${new URLSearchParams({ - secret: process.env.PAYLOAD_REVALIDATION_KEY ?? "", - collection, - fetchData, - }).toString()}`, + const fetchUrl = `${ + process.env.PUBLIC_FRONTEND_URL + }/next_api/revalidate?${new URLSearchParams({ + secret: process.env.PAYLOAD_REVALIDATION_KEY ?? "", + collection, + fetchData, + }).toString()}`; + req.payload.logger.info( + `sending revalidate request ${fetchUrl.replace(process.env.PAYLOAD_REVALIDATION_KEY ?? "", "REDACTED")}`, ); + const res = await fetch(fetchUrl); if (res.ok) { req.payload.logger.info( `Revalidated collection ${collection} with data ${fetchData}`, diff --git a/apps/cms/src/preview.ts b/apps/cms/src/preview.ts index a99fa68e..aeef1ddb 100644 --- a/apps/cms/src/preview.ts +++ b/apps/cms/src/preview.ts @@ -3,4 +3,4 @@ import type { GeneratePreviewURL } from "payload/config"; export const generatePreviewUrl = (getUrl: (doc: T) => string): GeneratePreviewURL => (doc) => - `${process.env.PUBLIC_FRONTEND_URL}/api/preview?url=${getUrl(doc as T)}`; + `${process.env.PUBLIC_FRONTEND_URL}/next_api/preview?url=${getUrl(doc as T)}`; diff --git a/apps/web/src/app/api/exit-preview/route.ts b/apps/web/src/app/next_api/exit-preview/route.ts similarity index 100% rename from apps/web/src/app/api/exit-preview/route.ts rename to apps/web/src/app/next_api/exit-preview/route.ts diff --git a/apps/web/src/app/api/preview/route.ts b/apps/web/src/app/next_api/preview/route.ts similarity index 100% rename from apps/web/src/app/api/preview/route.ts rename to apps/web/src/app/next_api/preview/route.ts diff --git a/apps/web/src/app/api/revalidate/route.ts b/apps/web/src/app/next_api/revalidate/route.ts similarity index 100% rename from apps/web/src/app/api/revalidate/route.ts rename to apps/web/src/app/next_api/revalidate/route.ts diff --git a/apps/web/src/middleware.ts b/apps/web/src/middleware.ts index d919f86f..3f2ab02f 100644 --- a/apps/web/src/middleware.ts +++ b/apps/web/src/middleware.ts @@ -21,5 +21,5 @@ export function middleware(request: NextRequest): NextResponse { ); } export const config = { - matcher: ["/((?!_next|fi|en).*)"], + matcher: ["/((?!_next|fi|en|next_api).*)"], };