Rewrite page in Svelte 5 #49

Merged
Neshura merged 94 commits from rewrite/svelte into main 2024-01-06 14:12:09 +00:00
Showing only changes of commit 0eb25708a0 - Show all commits

View file

@ -1,11 +1,35 @@
<svelte:options runes={true} /> <svelte:options runes={true} />
<script lang="ts"> <script lang="ts">
import pages from '$lib/components/pages.json'; import ServiceCard from '$lib/components/ServiceCard.svelte';
import Card from '$lib/components/Card.svelte';
import type { Service } from '$lib/types/data-types'; import type { Service } from '$lib/types/data-types';
const services: Array<Service> = $state(pages.services); let services: readonly Service[] = $state.frozen([]);
let icons: readonly string[] = $state.frozen([]);
async function get(url: string): Promise<any> {
let res = await fetch(url)
if (res.ok) {
let data = await res.json()
return data
}
else {
return Promise.reject()
}
}
$effect(() => {
get("/data/services").then((data: Service[]) => {
services = data
})
})
$effect(() => {
get("/assets/icons").then((data: string[]) => {
icons = data
})
})
</script> </script>
<svelte:head> <svelte:head>