diff --git a/admin/src/App.vue b/admin/src/App.vue index 7c3dd8514..359b63b3a 100644 --- a/admin/src/App.vue +++ b/admin/src/App.vue @@ -14,8 +14,8 @@ export default { components: { defaultLayout }, data() { return { - showLayout: CONFIG.DEBUG_DISABLE_AUTH || this.$store.state.token + showLayout: CONFIG.DEBUG_DISABLE_AUTH || this.$store.state.token, } - } + }, } diff --git a/admin/src/components/NavBar.vue b/admin/src/components/NavBar.vue index c4891c612..c52743857 100644 --- a/admin/src/components/NavBar.vue +++ b/admin/src/components/NavBar.vue @@ -50,9 +50,9 @@ export default { this.$router.push('/logout') }, wallet() { - window.location = CONFIG.WALLET_AUTH_URL.replace('$1',this.$store.state.token) + window.location = CONFIG.WALLET_AUTH_URL.replace('$1', this.$store.state.token) this.$store.dispatch('logout') // logout without redirect }, - } + }, } diff --git a/admin/src/config/index.js b/admin/src/config/index.js index 9f33b59cb..69d30a66a 100644 --- a/admin/src/config/index.js +++ b/admin/src/config/index.js @@ -19,12 +19,11 @@ const environment = { const endpoints = { GRAPHQL_URI: process.env.GRAPHQL_URI || 'http://localhost:4000/graphql', - // TODO port - WALLET_AUTH_URL: process.env.WALLET_AUTH_URL || 'http://localhost/vue/authenticate?token=$1' + WALLET_AUTH_URL: process.env.WALLET_AUTH_URL || 'http://localhost/vue/authenticate?token=$1', } const debug = { - DEBUG_DISABLE_AUTH: process.env.DEBUG_DISABLE_AUTH === 'true' || false + DEBUG_DISABLE_AUTH: process.env.DEBUG_DISABLE_AUTH === 'true' || false, } const options = {} diff --git a/admin/src/layouts/defaultLayout.vue b/admin/src/layouts/defaultLayout.vue index 71d2f894b..4f6cbbe4d 100644 --- a/admin/src/layouts/defaultLayout.vue +++ b/admin/src/layouts/defaultLayout.vue @@ -16,4 +16,4 @@ export default { FooTer, }, } - \ No newline at end of file + diff --git a/admin/src/router/guards.js b/admin/src/router/guards.js index a8bdaa2e2..f6d8058aa 100644 --- a/admin/src/router/guards.js +++ b/admin/src/router/guards.js @@ -1,11 +1,12 @@ -import CONFIG from "../config" +import CONFIG from '../config' const addNavigationGuards = (router, store) => { // store token on `authenticate` router.beforeEach((to, from, next) => { if (to.path === '/authenticate' && to.query.token) { - store.commit('token',to.query.token) - next({path: '/'}) + // TODO verify user to get user data + store.commit('token', to.query.token) + next({ path: '/' }) } else { next() } @@ -13,11 +14,12 @@ const addNavigationGuards = (router, store) => { // protect all routes but `not-found` router.beforeEach((to, from, next) => { - if (!CONFIG.DEBUG_DISABLE_AUTH && // we did not disabled the auth module for debug purposes - !store.state.token && // we do not have a token - to.path !== '/not-found' && // we are not on `not-found` - to.path !== '/logout') { // we are not on `logout` - console.log(!CONFIG.DEBUG_DISABLE_AUTH,!store.state.token,to.path !== '/not-found',to.path !== '/logout') + if ( + !CONFIG.DEBUG_DISABLE_AUTH && // we did not disabled the auth module for debug purposes + !store.state.token && // we do not have a token + to.path !== '/not-found' && // we are not on `not-found` + to.path !== '/logout' // we are not on `logout` + ) { next({ path: '/not-found' }) } else { next()