frontend lint

This commit is contained in:
Ulf Gebhardt 2021-11-20 16:37:25 +01:00
parent cefc963780
commit 33783702bc
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9
3 changed files with 6 additions and 8 deletions

View File

@ -122,7 +122,7 @@ export default {
this.$emit('logout') this.$emit('logout')
}, },
admin() { admin() {
window.location = CONFIG.ADMIN_AUTH_URL.replace('$1',this.$store.state.token) window.location = CONFIG.ADMIN_AUTH_URL.replace('$1', this.$store.state.token)
this.$store.dispatch('logout') // logout without redirect this.$store.dispatch('logout') // logout without redirect
}, },
getElopageLink() { getElopageLink() {

View File

@ -20,8 +20,7 @@ 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 ADMIN_AUTH_URL: process.env.ADMIN_AUTH_URL || 'http://localhost/admin/authenticate?token=$1',
ADMIN_AUTH_URL: process.env.ADMIN_AUTH_URL || 'http://localhost/admin/authenticate?token=$1'
} }
const options = {} const options = {}

View File

@ -11,16 +11,15 @@ const addNavigationGuards = (router, store) => {
// store token on authenticate // store token on authenticate
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
console.log('token', to.path, from.path, to.query)
if (to.path === '/authenticate' && to.query.token) { if (to.path === '/authenticate' && to.query.token) {
console.log('token', to.query.token, to) // TODO verify user in order to get user data
store.commit('token',to.query.token) store.commit('token', to.query.token)
next({path: '/overview'}) next({ path: '/overview' })
} else { } else {
next() next()
} }
}) })
// handle authentication // handle authentication
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
if (to.meta.requiresAuth && !store.state.token) { if (to.meta.requiresAuth && !store.state.token) {