From 8e7528efd3d4910f1b0a9939f757bf6b4ce074d4 Mon Sep 17 00:00:00 2001 From: Ayo Date: Sun, 4 Jun 2023 19:59:42 +0200 Subject: [PATCH] feat: add library link on to address bar --- src/components/AddressBar.astro | 16 ++++++++++++---- src/layouts/Layout.astro | 1 - src/pages/index.astro | 10 +++++++--- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/components/AddressBar.astro b/src/components/AddressBar.astro index 8ad00aa..ea81770 100644 --- a/src/components/AddressBar.astro +++ b/src/components/AddressBar.astro @@ -27,9 +27,15 @@ const form = new FormGroup([ value: "Get cozy!", }} /> - Star on GitHub + 📚 Library + • + ⭐️ GitHub + diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index d335b3a..c86b688 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -18,7 +18,6 @@ const { title } = Astro.props;
- Home
diff --git a/src/pages/index.astro b/src/pages/index.astro index 824a5e9..87ab057 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -7,7 +7,7 @@ import Library from "../components/Library.astro"; const params = Astro.url.searchParams; const url = params.get('url') || ''; -let article: ArticleData; +let article: ArticleData | null; let skipSave; const error = { @@ -16,7 +16,11 @@ const error = { } try { - article = await extract(url) || error; + article = await extract(url); + if (!article ) { + article = error; + skipSave = true; + } } catch { article = error; skipSave = true; @@ -34,5 +38,5 @@ if (url === '') { - +