After a user signed in his/her account, he/she will be ask what is his/her user role.
After selecting a role, it will then be save in the database,
So, how do we retrieve the specific data from firebase database and then print it in the html?
These are the codes I used in my .js
function app(user){
function updateMyStatus(e){
var myUpdate={};
myUpdate.email = user.email;
myUpdate.displayName = user.displayName;
myUpdate.status = document.getElementById("clientStatus").value;
fb.child(user.uid).set(myUpdate);
}
function receiveUpdate(received){
var data = received.val();
console.log( data );
document.getElementById('role').innerHTML= "";
}
document.getElementById('userName').innerHTML = user.displayName;
var fb = firebase.database().ref('Accounts');
document.getElementById("clientStatus")
.addEventListener("input",updateMyStatus);
}
and if the user has already a user role(status) as shown in the img 2, how do you hide the dropbox that is shown in the img 1?
Aucun commentaire:
Enregistrer un commentaire