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 },
data() {
return {
showLayout: CONFIG.DEBUG_DISABLE_AUTH || this.$store.state.token
showLayout: CONFIG.DEBUG_DISABLE_AUTH || this.$store.state.token,
}
}
},
}
</script>

View File

@ -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
},
}
},
}
</script>

View File

@ -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 = {}

View File

@ -16,4 +16,4 @@ export default {
FooTer,
},
}
</script>
</script>

View File

@ -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()

View File

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