I have a function that checks whether the user is logged in or not and another that protects the routes and I wanted the function's true or false value to check whether the user is logged in or not to be sent to "const authentication" in any way to do it? I thank anyone who can help
firebase.auth().onAuthStateChanged((user) => { if (user) { this.login = true /// types this //// this value console.log('logged') } else { this.login = false /// or this values console.log('nologin'); } }); const authentication={ isLoggedIn: this.login, //// go here onAuthentication(){ this.isLoggedIn=true; }, getLogInStatus(){ return this.isLoggedIn; } }
var globalVariable; function function1() { //set a value globalVariable=12; function2(); } function function2() { //local gets that same value var local = globalVariable; }
2.1m questions
2.1m answers
60 comments
57.0k users