firebase.auth().onAuthStateChanged(function(user) {
if (user) {
// User is signed in.
console.log("ADMIN is IN");
// window.location.href = "admin.html"
} else {
// No user is signed in.
console.log("No ADMIN");
window.location.href = "login.html";
}
});
function logout(){
console.log("Function RAN");
firebase.auth().signOut()
.then(function() {
console.log("FINE LOGOUT WORKED");
window.location.href = "login.html";
})
.catch(function(error) {
console.log(error);
});
}
Question 1:- here is my code it work fine on localhost but when i deploy it to firebase hosting it doesn't work?
Question 2:- Can i generate static html files from Cloud function to serve on firebase hosting.
For question 2: Yes! Take a look at the docs page on serving dynamic content with Cloud Functions