2023-11-28 20:05:44 +00:00
2023-11-02 17:16:15 +00:00
2024-01-07 22:27:49 +00:00
// User Request
2023-11-02 17:16:15 +00:00
2024-01-07 22:27:49 +00:00
loadUserInfo ( )
2023-11-28 20:05:44 +00:00
2023-11-02 17:16:15 +00:00
2024-01-07 22:27:49 +00:00
function loadUserInfo ( ) {
2024-01-13 17:44:27 +00:00
2024-01-07 22:27:49 +00:00
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 ( )
2024-01-13 17:44:27 +00:00
//
2024-01-07 22:27:49 +00:00
permissions . forEach ( ( permValue ) => {
AllComponents . forEach ( ( component ) => {
if ( component . permission == permValue ) {
component . inject ( AvailableViews )
}
} )
} )
2023-11-02 17:16:15 +00:00
2024-01-07 22:27:49 +00:00
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
} )
2024-01-07 22:27:49 +00:00
}
2023-11-02 17:16:15 +00:00
2024-01-13 17:44:27 +00:00