Skip to content

Commit

Permalink
Fix typescript issues
Browse files Browse the repository at this point in the history
  • Loading branch information
PolpOnline committed Nov 26, 2024
1 parent 12009fe commit ab6142d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/frontend/src/routes/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const load: PageServerLoad = async ({ fetch, url }) => {
fetch
});

if (error) {
if (error || !data || !data.systems) {
return new Response(`Failed to fetch: ${error}`, { status: response.status });
}

Expand Down
9 changes: 6 additions & 3 deletions src/frontend/src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
const inParams: FlyParams = { y: '100%', duration: 300, easing: cubicOut };
const outParams: FlyParams = { x: '100%', duration: 700, easing: cubicOut };
const animateParams: AnimationConfig = { delay: 0, duration: 300, easing: cubicOut };
const systems = data.systems!;
const form = data.form!;
</script>

<svelte:head>
Expand All @@ -29,12 +32,12 @@
<PageSelector />

<div class="grid grid-cols-1 gap-3 lg:grid-cols-2">
{#each data.systems as system (system.id)}
{#each systems as system (system.id)}
<div
in:fly={inParams}
out:fly={outParams}
animate:flip={animateParams}
class:custom-col-width={data.systems.length % 2 === 1}
class:custom-col-width={systems.length % 2 === 1}
class="h-full"
>
<ItemStatus data={system} />
Expand All @@ -43,7 +46,7 @@
</div>
</div>

<AddSystem data={data.form} />
<AddSystem data={form} />

<DeleteSystemDialog />

Expand Down
4 changes: 2 additions & 2 deletions src/frontend/src/routes/public/[id]/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ export const load: PageServerLoad = async ({ fetch, params, url }) => {
fetch
});

if (error) {
if (error || !data || !data.system) {
return new Response(`Failed to fetch: ${error}`, { status: response.status });
}

return {
system: data!.system
system: data.system
};
};
6 changes: 4 additions & 2 deletions src/frontend/src/routes/public/[id]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
let { data }: { data: PageData } = $props();
title.set(data.system.name + ' status');
const system = data.system!;
title.set(system.name + ' status');
</script>

<div class="mx-4">
<PageSelector />

<ItemStatus data={data.system} showDropdown={false} />
<ItemStatus data={system} showDropdown={false} />
</div>

0 comments on commit ab6142d

Please sign in to comment.