Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
joshniemela committed Jan 28, 2024
2 parents 00e22cb + cbf6e5f commit 40c8bd7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions frontend/src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import type { Overview } from "../course";
import { browser } from "$app/environment";
let loading = true;
let error: string | null = null;
let API_URL = apiUrl();
let courses: Overview[] = [];
let visibleCourses: Overview[] = [];
Expand Down Expand Up @@ -99,6 +100,11 @@
body: JSON.stringify(coerced_filters),
});
if (!res.ok) {
error = "Something went wrong";
loading = false;
return;
}
const json = await res.json();
loading = false;
courses = json.courses;
Expand Down Expand Up @@ -261,6 +267,9 @@
</p>
</div>
</div>
{#if error}
<h1 class="text-3xl text-center mt-10">{error}</h1>
{/if}

{#if loading}
<!--put the loader in the centre of the screen always----------------->
Expand Down

0 comments on commit 40c8bd7

Please sign in to comment.