Currently, I'm facing an issue with my login system. Whenever I access the dashboard and then refresh the page, it abruptly closes my session and redirects me back to the login page.
Below is a snippet from my main.js file:
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './assets/bootstrap.js'
import firebase from 'firebase'
createApp(App).use(store).use(router).mount('#app')
let app = null
firebase.auth().onAuthStateChanged(() => {
if (!app) {
new Vue({
router,
render: h => h(App)
}).$mount('#app')
}
})
Furthermore, here is the Index.js file from the router:
import { createRouter, createWebHistory } from 'vue-router'
import Home from '../views/Home.vue'
import firebase from 'firebase'
import Login from '@/views/Auth/Login'
import Register from '@/views/Auth/Register'
import Dashboard from '@/views/Dashboard.vue'
// Code for defining routes...
// Code for router navigation guard...
export default router
And the Login.vue component:
<template>
<div class="container">
<form v-on:submit.prevent="login" class="col-lg-3 offset-lg-4 ">
// Login form HTML code...
</script>
Can anyone provide insight on how to troubleshoot this issue? I've exhausted multiple methods and resources without success.