neutral/public/javascripts/indexscript.js

69 lines
1.6 KiB
JavaScript
Raw Normal View History

2023-11-28 20:05:44 +00:00
// User Request
loadUserInfo()
2023-11-28 20:05:44 +00:00
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()
})
2023-11-28 20:05:44 +00:00
})
}