From 06ce8fbab52c5c25a67a1518f1888b083b5edde3 Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Sat, 18 Feb 2023 15:40:35 +0100 Subject: . --- dist/sanity-client.d.ts | 1 - dist/sanity-client.js | 8 -------- dist/utils.js | 30 ------------------------------ 3 files changed, 39 deletions(-) delete mode 100644 dist/sanity-client.d.ts delete mode 100644 dist/sanity-client.js delete mode 100644 dist/utils.js (limited to 'dist') diff --git a/dist/sanity-client.d.ts b/dist/sanity-client.d.ts deleted file mode 100644 index e0f8358..0000000 --- a/dist/sanity-client.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare const sanity: import("@sanity/client").SanityClient; diff --git a/dist/sanity-client.js b/dist/sanity-client.js deleted file mode 100644 index 4415100..0000000 --- a/dist/sanity-client.js +++ /dev/null @@ -1,8 +0,0 @@ -import { env } from "$env/dynamic/private"; -import createSanityClient from "@sanity/client"; -export const sanity = createSanityClient({ - projectId: env.SANITY_STUDIO_API_PROJECT_ID, - dataset: env.SANITY_STUDIO_API_DATASET, - apiVersion: "2022-03-24", - useCdn: true, -}); diff --git a/dist/utils.js b/dist/utils.js deleted file mode 100644 index d89663e..0000000 --- a/dist/utils.js +++ /dev/null @@ -1,30 +0,0 @@ -// Replaces the locale slug in a URL. -// -// If the `full` argument is set to `true`, the full URL is returned as a string. -// e.g. https://mywebsite.com/en/blog/article-1 => https://mywebsite.com/de/blog/article-1 -// -// Otherwise (default) the URL relative to the base is returned. -// e.g. https://mywebsite.com/en/blog/article-1 => /de/blog/article-1 -export const replaceLocaleInUrl = (url, locale, full = false) => { - const [, , ...rest] = url.pathname.split('/'); - const new_pathname = `/${[locale, ...rest].join('/')}`; - if (!full) { - return `${new_pathname}${url.search}`; - } - const newUrl = new URL(url.toString()); - newUrl.pathname = new_pathname; - return newUrl.toString(); -}; -export function fromLocalizedString(localizedString, locale) { - if (typeof localizedString === "string") - return localizedString; - // @ts-ignore - if (localizedString[locale]) - return localizedString[locale]; - // @ts-ignore - if (localizedString["nb"]) - return localizedString["nb"]; - // @ts-ignore - if (localizedString["en"]) - return localizedString["en"]; -} -- cgit v1.3