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