Search
This commit is contained in:
17
public/variables.js
Normal file
17
public/variables.js
Normal file
@@ -0,0 +1,17 @@
|
||||
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);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user