Guest access work

This commit is contained in:
N-Pex 2020-11-25 10:02:24 +01:00
parent a164571218
commit 5589131c86
5 changed files with 138 additions and 35 deletions

View file

@ -16,14 +16,9 @@ const routes = [
component: Login
},
{
path: '/join/:room?',
redirect: from => {
const room = from.hash;
if (room) {
return { name: 'Chat', params: { joinRoom: room }};
}
return '/';
}
path: '/join/',
component: () => import('../components/Join.vue'),
props: true
},
]
@ -33,7 +28,7 @@ const router = new VueRouter({
router.beforeEach((to, from, next) => {
const publicPages = ['/login'];
const authRequired = !publicPages.includes(to.path);
const authRequired = !publicPages.includes(to.path) && !to.path.startsWith('/join/');
const loggedIn = localStorage.getItem('user');
// trying to access a restricted page + not logged in