Firebase Auth redirection after login


#1

Hi, I’m building my first integration of framework7, vue and firebase.

I’m not using vue-router, and I like to redirect my users after a success login to the home page.
Here’s is the code I’m trying in main app.js but is not working.

 methods: {
    onF7Ready(f7) {
        firebase.initializeApp(config);
        firebase.auth().onAuthStateChanged(function(user) {
            if (user){
                f7.views.create('#main-view', { url: '/home/' })
            } else {
                f7.views.create('#main-view', { url: '/login/' })
            }
        })
    },
  },

Any help would be very appreciated.


#2

If your main view was already created then it should be:

f7.views.main.router.navigate('/home/')

or

f7.views.main.router.navigate('/login/')