AquaNet: Added an Error Message trigger to pages that didn't telegraph to the user that there was an error before.

This commit is contained in:
Galexion
2024-02-29 22:48:41 -05:00
parent 88b7804123
commit c4309aa14c
5 changed files with 45 additions and 16 deletions

View File

@@ -8,6 +8,7 @@
import 'chartjs-adapter-moment';
import { DATA, GAME } from "../libs/sdk";
import { type GameName, getMult } from "../libs/scoring";
import ErrorMessage from "../ErrorMessage.svelte";
registerChart()
@@ -15,7 +16,7 @@
export let game: GameName
game = game || "mai2"
let calElement: HTMLElement
let ifError = null
title(`User ${username}`)
interface MusicAndPlay extends MusicMeta, GenericGamePlaylog {}
@@ -38,7 +39,9 @@
d = {user, trend, recent: user.recent.map(it => {return {...music[it.musicId], ...it}})}
localStorage.setItem("tmp-user-details", JSON.stringify(d))
renderCal(calElement, trend.map(it => {return {date: it.date, value: it.plays}}))
})
}).catch((error) => {
ifError = error;
});
const pfpNotFound = (e: Event) => {
(e.target as HTMLImageElement).src = "/assets/imgs/no_profile.png"
@@ -191,7 +194,9 @@
{/each}
</div>
</div>
{:else}
{:else if ifError}
<ErrorMessage {ifError}/>
{:else}
<p>Loading...</p>
{/if}
</main>