blob: 9e29927d8dc091d5d4f31b0841956d810e1f3ad5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
var User = {};
/**
* Handles
* @param {ProgressEvent} event
* @this {XMLHttpRequest}
*/
function update_user_data (event) {
let result = JSON.parse(this.responseText);
if (this.status >= 400)
return;
User = result;
// Grab and change user links to point at user orofile, link text to username
/** @type {HTMLLinkElement} */
let link = document.getElementById("user-link");
/** @type {HTMLImageElement} */
let profile_icon = document.getElementById("user-profile");
link.href = "/user/"
profile_icon.parentElement.href = "/user/"
link.innerText = "Go To Profile"
}
// Run at start, grab user information and replace the login link as well as the user object
(() => {
let user_req = new XMLHttpRequest();
user_req.addEventListener("load", update_user_data);
user_req.open("GET", API_BASE_URL + "/user");
user_req.send();
})();
|