From d7bfae6bb7a3afc6e7f0db9d2a2a6f14b23b4f3b Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Mon, 25 Jan 2021 18:28:15 +0100 Subject: [PATCH] Update api-utils.ts --- packages/next/next-server/server/api-utils.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/next/next-server/server/api-utils.ts b/packages/next/next-server/server/api-utils.ts index a5f9430ab0776..6a1f3cea86e7b 100644 --- a/packages/next/next-server/server/api-utils.ts +++ b/packages/next/next-server/server/api-utils.ts @@ -364,6 +364,10 @@ export function tryGetPreviewData( } } +function isNotValidData (str: string): boolean { + return typeof str !== 'string' || str.length < 16 +} + function setPreviewData( res: NextApiResponse, data: object | string, // TODO: strict runtime type checking @@ -371,10 +375,6 @@ function setPreviewData( maxAge?: number } & __ApiPreviewProps ): NextApiResponse { - const isNotValidData = (str: string): boolean => { - return typeof str !== 'string' || str.length < 16 - } - if (isNotValidData(options.previewModeId)) { throw new Error('invariant: invalid previewModeId') }