Whenever I enter my page, I have redirect to inside panel if user is logged in. I am checking here
router.beforeEach((to, from, next) => {
if (to.matched.some(record => record.meta.authRequired)) {
const { authState } = useAuthStore(router.pinia);
if (authState == false) {
return next('/login')
}
}
next();
});
If user is not logged in, I am seeing a 0.5sec flash of Panel component, is there way to avoid this?
const routes = [
{
path: "/",
name: "Base",
component: Base,
redirect: "/",
meta: {
authRequired: true,
},
children: [
{
path: "",
name: "Panel",
component: Panel,