From cded0a9cbb4779490bbb2c2b74440f062c32e5ff Mon Sep 17 00:00:00 2001 From: Nikita Karamov Date: Sun, 26 Mar 2023 16:49:22 +0200 Subject: [PATCH] Move instance fetching to client --- src/components/instance-select.astro | 16 +++------------- src/fetch-instances.ts | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 13 deletions(-) create mode 100644 src/fetch-instances.ts diff --git a/src/components/instance-select.astro b/src/components/instance-select.astro index 980fa3f..859227b 100644 --- a/src/components/instance-select.astro +++ b/src/components/instance-select.astro @@ -4,21 +4,10 @@ * Licensed under AGPL v3 or later */ -let instances; -try { - const response = await fetch(new URL("/api/instances", Astro.url)); - instances = await response.json(); -} catch (error) { - console.error("Couln't fetch instances:", error); - instances = []; -} - const { prefilledInstance } = Astro.props; --- - - {instances.map((instance: string) => +