From df07435874bdb39fd2be244f3338d3e8b4aed92f Mon Sep 17 00:00:00 2001 From: Korbs Date: Wed, 23 Oct 2024 14:00:21 -0400 Subject: [PATCH] Add skeleton animation, adjust query text, and use default API link from ENV --- source/src/pages/web.astro | 69 ++++++++++++++++++++++++++++++++++---- 1 file changed, 62 insertions(+), 7 deletions(-) diff --git a/source/src/pages/web.astro b/source/src/pages/web.astro index 85a261a..046a0f4 100644 --- a/source/src/pages/web.astro +++ b/source/src/pages/web.astro @@ -2,30 +2,85 @@ // Layout import Search from "@layouts/Search.astro"; +// Configuration +import { + DEFAULT_API +} from "@utils/GetConfig" + // Components -import WebLink from "@components/search/WebLink.astro"; import RelatedSearches from "@components/search/RelatedSearches.astro"; +import WebLink from "@components/search/WebLink.astro"; +import WebLinkSkeleton from "@components/search/WebLinkSkeleton.astro"; // Fetch -const QueryText = Astro.url.href.split("web?=").pop() -const Query = await fetch("https://4get.sudovanilla.org" + "/api/v1/web?s=" + QueryText).then((response) => response.json()); +const QueryString = Astro.url.href.split("web?=").pop() // Get user's search query from URL +const QueryText = `${QueryString}`.replaceAll("%20", " ") // Replace "%20" with a space +const Query = await fetch(DEFAULT_API + "/api/v1/web?s=" + QueryString).then((response) => response.json()); // Response --- - + {Query.web.map((query) => ( + > + + ))} - + {Query.related.map((related) => ( {related} ))} + + + + JSON Response - \ No newline at end of file + + + \ No newline at end of file