mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-02-23 13:51:13 +01:00
Refactoring of fe4ebd58
: Set Close/Back buttons to always browse back
This commit is contained in:
parent
70313995b9
commit
d7942b4233
@ -4,7 +4,7 @@
|
||||
<div class="tabs is-centered is-fullwidth">
|
||||
<ul>
|
||||
<li v-for="tab in tabs" :key="tab.view" :class="{ 'is-active': tab.view === activeTab }">
|
||||
<router-link :id="tab.id" :to="{ name: tab.view }">{{ tab.name }}</router-link>
|
||||
<router-link :id="tab.id" :to="{ name: tab.view, params: {returnTo: $route.params.returnTo} }">{{ tab.name }}</router-link>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
16
resources/js/routes.js
vendored
16
resources/js/routes.js
vendored
@ -85,6 +85,22 @@ router.beforeEach((to, from, next) => {
|
||||
if (to.name !== 'login' && to.meta.requiresAuth && ! Vue.$storage.get('authenticated', false)) {
|
||||
next({ name: 'login' })
|
||||
}
|
||||
else if (to.name.startsWith('settings.')) {
|
||||
if (to.params.returnTo == undefined) {
|
||||
if (from.params.returnTo) {
|
||||
next({name: to.name, params: { returnTo: from.params.returnTo }})
|
||||
}
|
||||
else if (from.name) {
|
||||
next({name: to.name, params: { returnTo: from.path }})
|
||||
}
|
||||
else {
|
||||
next({name: to.name, params: { returnTo: '/accounts' }})
|
||||
}
|
||||
}
|
||||
else {
|
||||
next()
|
||||
}
|
||||
}
|
||||
else if (to.matched.some(record => record.meta.disabledWithAuthProxy)) {
|
||||
if (window.appConfig.proxyAuth) {
|
||||
next({ name: 'accounts' })
|
||||
|
@ -151,19 +151,6 @@
|
||||
},
|
||||
},
|
||||
|
||||
beforeRouteEnter(to, from, next) {
|
||||
next(vm => {
|
||||
if (from.params.returnTo) {
|
||||
to.params.returnTo = from.params.returnTo
|
||||
}
|
||||
else {
|
||||
to.params.returnTo = from.name
|
||||
? from.path
|
||||
: '/accounts'
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
beforeRouteLeave(to, from, next) {
|
||||
if (to.name == 'accounts') {
|
||||
this.$notify({ clean: true })
|
||||
|
@ -156,19 +156,6 @@
|
||||
},
|
||||
},
|
||||
|
||||
beforeRouteEnter(to, from, next) {
|
||||
next(vm => {
|
||||
if (from.params.returnTo) {
|
||||
to.params.returnTo = from.params.returnTo
|
||||
}
|
||||
else {
|
||||
to.params.returnTo = from.name
|
||||
? from.path
|
||||
: '/accounts'
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
beforeRouteLeave(to, from, next) {
|
||||
if (to.name == 'accounts') {
|
||||
this.$notify({ clean: true })
|
||||
|
@ -260,19 +260,6 @@
|
||||
|
||||
},
|
||||
|
||||
beforeRouteEnter(to, from, next) {
|
||||
next(vm => {
|
||||
if (from.params.returnTo) {
|
||||
to.params.returnTo = from.params.returnTo
|
||||
}
|
||||
else {
|
||||
to.params.returnTo = from.name
|
||||
? from.path
|
||||
: '/accounts'
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
beforeRouteLeave(to, from, next) {
|
||||
if (to.name == 'accounts') {
|
||||
this.$notify({ clean: true })
|
||||
|
@ -224,19 +224,6 @@
|
||||
|
||||
},
|
||||
|
||||
beforeRouteEnter(to, from, next) {
|
||||
next(vm => {
|
||||
if (from.params.returnTo) {
|
||||
to.params.returnTo = from.params.returnTo
|
||||
}
|
||||
else {
|
||||
to.params.returnTo = from.name
|
||||
? from.path
|
||||
: '/accounts'
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
beforeRouteLeave(to, from, next) {
|
||||
if (to.name == 'accounts') {
|
||||
this.$notify({ clean: true })
|
||||
|
Loading…
Reference in New Issue
Block a user