Now that there's an init function I should probably fail early on invalid knownsoftware json
11 lines
494 B
TypeScript
11 lines
494 B
TypeScript
import { findImageOrFail } from "./dom.mjs";
|
|
|
|
async function populateUsers(charlotteSelector: string, kioSelector: string) {
|
|
const charlotteImage = findImageOrFail(document.body, charlotteSelector);
|
|
const kioImage = findImageOrFail(document.body, kioSelector);
|
|
const { charlotte, kio } = await fetch("/api/nekomata_avatars").then(r => r.json());
|
|
if (charlotte) charlotteImage.src = charlotte;
|
|
if (kio) kioImage.src = kio;
|
|
}
|
|
|
|
populateUsers("#charlotteAvatar", "#kioAvatar");
|