import { postData } from "./client.js";

populateuserData();
async function populateuserData() {
    const user = await postData("/getInfo", {}, window.localStorage.getItem("token"));

    for (const [attribute, value] of Object.entries(user)) {
        document.querySelectorAll(`.user-${attribute}`).forEach(element => {
            if (attribute === "FirstName" && !value) {
                var text = element.textContent;
                element.textContent = text.replace("%", user.Username);
            }
            var text = element.textContent;
            element.textContent = text.replace("%", value);
        });
    }
}
