From b5df2b6b1f5f9221b2e2e073d13eb7a04836fd44 Mon Sep 17 00:00:00 2001 From: "ecospark[bot]" <128108030+ecospark[bot]@users.noreply.github.com> Date: Thu, 12 Dec 2024 13:30:58 +0100 Subject: [PATCH] =?UTF-8?q?chore(prettier):=20=F0=9F=A4=96=20=E2=9C=A8=20(?= =?UTF-8?q?#44)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: ecospark[bot] <128108030+ecospark[bot]@users.noreply.github.com> --- astro/src/components/SanityLive.astro | 34 +++++++++++++-------------- astro/src/layouts/Layout.astro | 4 ++-- astro/src/pages/index.astro | 2 +- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/astro/src/components/SanityLive.astro b/astro/src/components/SanityLive.astro index 5bd9999..0eed793 100644 --- a/astro/src/components/SanityLive.astro +++ b/astro/src/components/SanityLive.astro @@ -1,12 +1,12 @@ \ No newline at end of file + error: (error: unknown) => { + if (error instanceof CorsOriginError) { + console.warn( + `Sanity Live is unable to connect to the Sanity API as the current origin - ${window.origin} - is not in the list of allowed CORS origins for this Sanity Project.`, + error.addOriginUrl && `Add it here:`, + error.addOriginUrl?.toString(), + ) + } else { + console.error(error) + } + }, + }) + window.addEventListener('beforeunload', () => subscription.unsubscribe()) + diff --git a/astro/src/layouts/Layout.astro b/astro/src/layouts/Layout.astro index a9e87e8..17483ea 100644 --- a/astro/src/layouts/Layout.astro +++ b/astro/src/layouts/Layout.astro @@ -1,6 +1,6 @@ --- -import { ClientRouter } from 'astro:transitions'; -import SanityLive from '../components/SanityLive.astro'; +import {ClientRouter} from 'astro:transitions' +import SanityLive from '../components/SanityLive.astro' --- diff --git a/astro/src/pages/index.astro b/astro/src/pages/index.astro index d934207..f8f0782 100644 --- a/astro/src/pages/index.astro +++ b/astro/src/pages/index.astro @@ -1,8 +1,8 @@ --- import {defineQuery} from 'groq' -import {sanityFetch} from '../sanity/fetch' import Welcome from '../components/Welcome.astro' import Layout from '../layouts/Layout.astro' +import {sanityFetch} from '../sanity/fetch' export const prerender = false