lint admin

This commit is contained in:
Ulf Gebhardt 2021-11-20 16:40:38 +01:00
parent 7ba1ec8482
commit df74427c39
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9
6 changed files with 18 additions and 17 deletions

View File

@ -14,8 +14,8 @@ export default {
components: { defaultLayout }, components: { defaultLayout },
data() { data() {
return { return {
showLayout: CONFIG.DEBUG_DISABLE_AUTH || this.$store.state.token showLayout: CONFIG.DEBUG_DISABLE_AUTH || this.$store.state.token,
}
} }
},
} }
</script> </script>

View File

@ -50,9 +50,9 @@ export default {
this.$router.push('/logout') this.$router.push('/logout')
}, },
wallet() { 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 this.$store.dispatch('logout') // logout without redirect
}, },
} },
} }
</script> </script>

View File

@ -19,12 +19,11 @@ const environment = {
const endpoints = { const endpoints = {
GRAPHQL_URI: process.env.GRAPHQL_URI || 'http://localhost:4000/graphql', 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 = { const debug = {
DEBUG_DISABLE_AUTH: process.env.DEBUG_DISABLE_AUTH === 'true' || false DEBUG_DISABLE_AUTH: process.env.DEBUG_DISABLE_AUTH === 'true' || false,
} }
const options = {} const options = {}

View File

@ -1,11 +1,12 @@
import CONFIG from "../config" import CONFIG from '../config'
const addNavigationGuards = (router, store) => { const addNavigationGuards = (router, store) => {
// store token on `authenticate` // store token on `authenticate`
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
if (to.path === '/authenticate' && to.query.token) { if (to.path === '/authenticate' && to.query.token) {
store.commit('token',to.query.token) // TODO verify user to get user data
next({path: '/'}) store.commit('token', to.query.token)
next({ path: '/' })
} else { } else {
next() next()
} }
@ -13,11 +14,12 @@ const addNavigationGuards = (router, store) => {
// protect all routes but `not-found` // protect all routes but `not-found`
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
if (!CONFIG.DEBUG_DISABLE_AUTH && // we did not disabled the auth module for debug purposes if (
!CONFIG.DEBUG_DISABLE_AUTH && // we did not disabled the auth module for debug purposes
!store.state.token && // we do not have a token !store.state.token && // we do not have a token
to.path !== '/not-found' && // we are not on `not-found` to.path !== '/not-found' && // we are not on `not-found`
to.path !== '/logout') { // we are not on `logout` to.path !== '/logout' // we are not on `logout`
console.log(!CONFIG.DEBUG_DISABLE_AUTH,!store.state.token,to.path !== '/not-found',to.path !== '/logout') ) {
next({ path: '/not-found' }) next({ path: '/not-found' })
} else { } else {
next() next()

View File

@ -16,7 +16,7 @@ export const mutations = {
}, },
token: (state, token) => { token: (state, token) => {
state.token = token state.token = token
} },
} }
export const actions = { export const actions = {