import { findImageOrFail } from "./dom.mjs"; async function populateUser(selector: string, origin: string, userId: string) { const avatarImage = findImageOrFail(document.body, selector); const userData = await fetch(`https://${origin}/api/users/show`, { method: "POST", body: JSON.stringify({ userId, }) }).then(r => r.json()); if (userData.avatarUrl) { avatarImage.src = userData.avatarUrl; } } populateUser("#charlotteAvatar", "eepy.moe", "9xt2s326nxev039h"); populateUser("#kioAvatar", "kitsunes.club", "9810gvfne3");