Implement some authentication

This commit is contained in:
2022-09-25 23:57:17 +02:00
parent 1a46cf7ef3
commit fb44bc2178
15 changed files with 373 additions and 206 deletions

View File

@@ -23,18 +23,17 @@
<script lang="ts">
export let timestamp: string;
export let type: string;
export let value: any;
let icon = "far fa-circle-question";
let text = "Unknown event";
let text = `Unknown event (${type})`;
if ("type" in value) {
let m = mappings.get(value.type);
if (m) {
let mapped = m(value);
icon = mapped.icon;
text = mapped.text;
}
let m = mappings.get(type);
if (m) {
let mapped = m(value);
icon = mapped.icon;
text = mapped.text;
}
let datetime = new Date(timestamp);

View File

@@ -4,7 +4,8 @@
const ENDPOINT = "/api/events";
let events: { _id: string; timestamp: string; value: any }[] = [];
let events: { _id: string; timestamp: string; type: string; value: any }[] =
[];
onMount(() => {
let int = setInterval(async () => {