neutral/public/javascripts/indexscript.js
Raphix 3484ff9ff7
All checks were successful
Neutral/pipeline/head This commit looks good
Version 1.0.0 - Ajout de WebMetrics et de l'édit utilisateur
2024-01-13 18:44:27 +01:00

69 lines
1.6 KiB
JavaScript

// User Request
loadUserInfo()
function loadUserInfo() {
const infoUsername = getID("infoUsername")
const infoUserimage = getID("infoUserimage")
const infoDisplayname = getID("infoDisplayname")
const views = getID("views")
const panelBox = getID("panel-box")
const REQ_user = get("USERINFO")
REQ_user.then((ANS_user) => {
console.log(ANS_user)
infoUserimage.src = ANS_user.picture
infoUsername.innerHTML = ANS_user.username
infoDisplayname.innerHTML = ANS_user.display_name
const permissions = ANS_user.permission
const AvailableViews = new Array()
//
permissions.forEach((permValue) => {
AllComponents.forEach((component) => {
if(component.permission == permValue) {
component.inject(AvailableViews)
}
})
})
if(AvailableViews.join("") == "") {
AvailableViews.push("<p style='width: 100%;' class='yellow t-center'><i class='fa-solid fa-warning'></i> Aucune permission ne semble vous êtes accordée<br>Demandez à Raphix afin de résoudre ce problème</p>")
views.classList.remove("views-box")
panelBox.style.justifyContent = "unset"
console.log(panelBox.style)
} else {
views.classList.add("views-box")
}
views.innerHTML = AvailableViews.join("")
// BindView
AllComponents.forEach((component) => {
component.bindView()
})
})
}