main page now fetches status with timestamp from netstatus backend. not styled yet
This commit is contained in:
@@ -8,12 +8,36 @@
|
||||
import UpdateEntry from "$lib/components/update-entry.svelte";
|
||||
import IndieButton from "$lib/components/indie-button.svelte";
|
||||
import { buttons } from "$lib/components/indie-button";
|
||||
import { onMount } from "svelte";
|
||||
|
||||
let latestDevlogDate = devlogPosts[0].post.date;
|
||||
let latestBlogDate = blogPosts[0].post.date;
|
||||
|
||||
let updateEntriesTrimmed = updateEntries.slice(0, 4);
|
||||
|
||||
let latestStatusContent = $state("fetching status...");
|
||||
let latestStatusTimestamp = $state("?");
|
||||
|
||||
async function getLatestStatus() {
|
||||
await fetch(`https://back.natconf.dev/netstatus/latestStatus`, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
}).then((response) => {
|
||||
return response.json();
|
||||
}).then((data) => {
|
||||
latestStatusContent = data.content;
|
||||
|
||||
// using sv-SE because they use ISO 8601 for the formatting. they also luckily follow the same timezone as Germany. thank you sweden, u cool 🇸🇪🇩🇪
|
||||
latestStatusTimestamp = new Date(data.timestamp).toLocaleString("sv-SE").replace(" ", ", ");
|
||||
});
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
getLatestStatus();
|
||||
})
|
||||
|
||||
const galleryTopRow: GalleryRowEntry[] = [
|
||||
{
|
||||
title: "Homesick – devlog",
|
||||
@@ -98,6 +122,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>{latestStatusTimestamp} :: {latestStatusContent}</p>
|
||||
|
||||
<GalleryRow entries={galleryTopRow} />
|
||||
<GalleryRow entries={galleryBottomRow} />
|
||||
|
||||
|
||||
Reference in New Issue
Block a user