import { CONFIG } from './config.js'; /** * Fills in the top bar's "signed in as … / Sign out" from /api/v1/me, and shows the Admin link * to admins. Pass the elements that exist on the page; missing ones are skipped. */ export function showSignedInUser(me, { signedIn, signedInEmail, signOut, adminLink } = {}) { const who = me?.email || me?.name; if (who && signedIn) { // nothing to show without Microsoft 365 sign-in (dev, mock) signedInEmail.textContent = who; signOut.href = CONFIG.signOutUrl; signedIn.hidden = false; } if (me?.is_admin && adminLink) { adminLink.href = `/admin.html${location.search}`; // keeps ?mock=1 adminLink.hidden = false; } }