summaryrefslogtreecommitdiffstats
path: root/webapp/src/router.js
diff options
context:
space:
mode:
authorJannik Schönartz2019-02-22 02:59:26 +0100
committerJannik Schönartz2019-02-22 02:59:26 +0100
commit892a048d072d05886951bcb92e6b61c2094a6463 (patch)
tree2ff89b4d69c829304f55d529203eed985aaac413 /webapp/src/router.js
parentrework user api to rest (diff)
downloadbas-892a048d072d05886951bcb92e6b61c2094a6463.tar.gz
bas-892a048d072d05886951bcb92e6b61c2094a6463.tar.xz
bas-892a048d072d05886951bcb92e6b61c2094a6463.zip
[authentication] Implement initial root account setup
[backend] Reworked authentication library to the api structure Add authentication api to remove the login routes from the router.js [webapp] Split login Page in StartPage + Login/Setup Add Setup Page for the initial root creation
Diffstat (limited to 'webapp/src/router.js')
-rw-r--r--webapp/src/router.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/webapp/src/router.js b/webapp/src/router.js
index 7a6e6d4..2af8d0d 100644
--- a/webapp/src/router.js
+++ b/webapp/src/router.js
@@ -1,8 +1,8 @@
import Vue from 'vue'
import Router from 'vue-router'
-import LoginPage from '@/components/LoginPage'
import DashboardPage from '@/components/DashboardPage'
import dashboardModules from '@/config/dashboard'
+import StartPage from '@/components/StartPage'
function setChildren (routes, parentName) {
routes.forEach(route => {
@@ -21,9 +21,10 @@ var router = new Router({
mode: 'history',
routes: [
{
- path: '/login',
- name: 'login',
- component: LoginPage
+ path: '/',
+ name: 'start',
+ component: StartPage,
+ children: StartPage.routes()
},
{
path: '/dashboard',
@@ -41,10 +42,10 @@ var router = new Router({
const registerRouterGuards = function (store) {
router.beforeEach((to, from, next) => {
const loggedIn = document.cookie.indexOf('jwt_hp') >= 0
- if (to.name === 'login') {
+ if (to.name === 'login' || to.name === 'start') {
if (loggedIn) next({ name: 'dashboard' })
else next()
- } else if (!loggedIn) {
+ } else if (!loggedIn && to.name !== 'setup') {
store.commit('setLoginRedirect', to.fullPath)
next({ name: 'login' })
} else {