20 lines
477 B
JavaScript
20 lines
477 B
JavaScript
async function getData() {
|
|
const url = "https://login.ami.sc/";
|
|
try {
|
|
const response = await fetch(url);
|
|
|
|
if (!response.ok) {
|
|
throw new Error(`Response status: ${response.status}`);
|
|
}
|
|
|
|
const user_name = response.headers.get("X-Authentik-Name");
|
|
console.log(user_name);
|
|
document.getElementById("username").innerHTML = user_name;
|
|
|
|
} catch (error) {
|
|
console.error(error.message);
|
|
}
|
|
}
|
|
|
|
getData();
|