Guest access work
This commit is contained in:
parent
a164571218
commit
5589131c86
5 changed files with 138 additions and 35 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue