Skip to content

Commit

Permalink
fix: remove next path from auth guard
Browse files Browse the repository at this point in the history
  • Loading branch information
acnormun committed Apr 3, 2024
1 parent aae0acb commit 0c06a78
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,23 +110,33 @@ const router = createRouter({
path: '/loginexternal/:token/:project/:flowOrg',
name: 'externalLogin',
component: null,
beforeEnter: [authGuard],
beforeEnter: (to, from, next) => {
const { token, project, flowOrg } = to.params;
auth_store().externalLogin({ token: token.replace('+', ' ') });
auth_store().selectedProject({ project });
auth_store().selectedFlowOrg({ flowOrg });
if (to.query.next) {
next(to.query.next);
} else {
next();
}
},
},
],
});

function authGuard(to) {
const { token, project, flowOrg } = to.params;
auth_store().externalLogin({ token: token.replace('+', ' ') });
auth_store().selectedProject({ project });
auth_store().selectedFlowOrg({ flowOrg });
if (to.query.next) {
return { path: to.query.next };
} else {
// next({name: 'Discovery'});
return { path: '/apps/discovery' };
}
}
// function authGuard(to) {
// const { token, project, flowOrg } = to.params;
// auth_store().externalLogin({ token: token.replace('+', ' ') });
// auth_store().selectedProject({ project });
// auth_store().selectedFlowOrg({ flowOrg });
// if (to.query.next) {
// return { path: to.query.next };
// } else {
// // next({name: 'Discovery'});
// return { path: '/apps/discovery' };
// }
// }

router.afterEach(() => {
window.parent.postMessage(
Expand Down

0 comments on commit 0c06a78

Please sign in to comment.