Skip to content

Commit e39a121

Browse files
authored
Merge pull request #1151 from oliver-sanders/1147
router: strip the ?token when the app is first loaded
2 parents f3404cf + 5c5ca00 commit e39a121

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/main.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ Vue.prototype.$eventBus = mitt()
3535

3636
Vue.config.productionTip = false
3737

38+
if (location.search) {
39+
// Vue Router puts the "hash" (#) after the "search" (?) for some reason.
40+
// But the router fails to read the search parameters because of this?
41+
// See this rather confusing issue for details:
42+
// https://github.com/vuejs/vue-router/issues/2125
43+
// In the mean time we have to hack the path ourselves to reverse the order
44+
// of the "?" and "#" parts so that the router can work with it.
45+
location.replace(location.pathname + location.hash + location.search)
46+
}
47+
3848
/* eslint-disable no-new */
3949
const app = new Vue({
4050
i18n,

src/router/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ Vue.use(Meta)
6969

7070
router.beforeResolve((to, from, next) => {
7171
NProgress.start()
72+
if ('token' in to.query) {
73+
// Remove ?token from the query, we only need it on load.
74+
router.replace({ query: {} })
75+
}
7276
if (to.name) {
7377
let title
7478
let workflowName

0 commit comments

Comments
 (0)