I need do get a specific element in my array to make a validation and get a return of a specific navigation bar. navigation.ts
public get() {
this.uuid = this.usuarioService.usuarioConectado()
let ref = this.usuarioService.getUsuario();
ref.once('value', (snapshotChanges) =>{
this.usuario.push(snapshotChanges.val())
console.log("this.user.push", this.usuario)
let usuario_logado = this.usuario[0][this.uuid]
var role = this.usuario[0][this.uuid].role
console.log("USER LOGADO", usuario_logado)
console.log("ROLE USER LOGADO", role)
this.role = role
}).finally(() => {
switch(this.role){
case "USUARIO":{
console.log("USUARIO||ON")
return NavigationItems
}
case "OPERADOR":{
console.log("OPERADOR||ON")
return NavigationItemsParceiros
}
default:{
console.log("Role não definida")
return NavigationItemsParceiros
}
}
})
}
}
But, in this way, i don't get the return of NavigationItems/NavigationItemsParceiros, only read the console.log, how is the correct way to do that