From b47e7330656ff5dd14073c0f0b6b1ba01ed34735 Mon Sep 17 00:00:00 2001 From: Ane Date: Fri, 27 Sep 2024 11:15:56 +0200 Subject: [PATCH] fix build fail --- src/middleware.ts | 2 +- studio/lib/queries/redirect.ts | 10 ++++++++++ studio/lib/queries/siteSettings.ts | 10 ---------- 3 files changed, 11 insertions(+), 11 deletions(-) create mode 100644 studio/lib/queries/redirect.ts diff --git a/src/middleware.ts b/src/middleware.ts index 8e46e7259..e69dfba5c 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -1,7 +1,7 @@ import { NextRequest, NextResponse } from "next/server"; import { RedirectDestinationSlugPage } from "studio/lib/interfaces/redirect"; -import { REDIRECT_BY_SOURCE_SLUG_QUERY } from "studio/lib/queries/siteSettings"; +import { REDIRECT_BY_SOURCE_SLUG_QUERY } from "studio/lib/queries/redirect"; import { readBaseUrl } from "./app/env"; import { HTTP_STATUSES } from "./utils/http"; diff --git a/studio/lib/queries/redirect.ts b/studio/lib/queries/redirect.ts new file mode 100644 index 000000000..b54619985 --- /dev/null +++ b/studio/lib/queries/redirect.ts @@ -0,0 +1,10 @@ +import { groq } from "next-sanity"; + +export const REDIRECT_BY_SOURCE_SLUG_QUERY = groq` + *[_type == "brokenLink" && source.current == $slug][0]{ + "destination": select( + destination.type == "reference" => destination.reference->slug.current, + destination.type == "external" => destination.external + ) + } +`; diff --git a/studio/lib/queries/siteSettings.ts b/studio/lib/queries/siteSettings.ts index 5c0d7aba1..f704416f8 100644 --- a/studio/lib/queries/siteSettings.ts +++ b/studio/lib/queries/siteSettings.ts @@ -71,13 +71,3 @@ export const DEFAULT_SEO_QUERY = groq`*[_type == "seoFallback"]{ "seoImageUrl": seoImage.asset->url } }[0]`; - -//Broken Links -export const REDIRECT_BY_SOURCE_SLUG_QUERY = groq` - *[_type == "redirect" && source.current == $slug][0]{ - "destination": select( - destination.type == "reference" => destination.reference->slug.current, - destination.type == "external" => destination.external - ) - } -`;