link to admin if isAdmin is true

This commit is contained in:
Ulf Gebhardt 2021-11-19 19:55:43 +01:00
parent a1e8114673
commit f8404fc9a9
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9
4 changed files with 19 additions and 3 deletions

View File

@ -1,3 +1,4 @@
GRAPHQL_URI=http://localhost:4000/graphql GRAPHQL_URI=http://localhost:4000/graphql
DEFAULT_PUBLISHER_ID=2896 DEFAULT_PUBLISHER_ID=2896
//BUILD_COMMIT=0000000 #BUILD_COMMIT=0000000
ADMIN_AUTH_URL=http://localhost/admin/authenticate?token=$1

View File

@ -45,6 +45,7 @@
<slot name="links"></slot> <slot name="links"></slot>
</ul> </ul>
<hr class="my-2" /> <hr class="my-2" />
<ul class="navbar-nav ml-3"> <ul class="navbar-nav ml-3">
<li class="nav-item"> <li class="nav-item">
<a :href="getElopageLink()" class="nav-link" target="_blank"> <a :href="getElopageLink()" class="nav-link" target="_blank">
@ -54,6 +55,14 @@
</li> </li>
</ul> </ul>
<ul class="navbar-nav ml-3" v-if="this.$store.state.isAdmin">
<li class="nav-item">
<a class="nav-link ponter" @click="admin">
{{ $t('admin_area') }}
</a>
</li>
</ul>
<ul class="navbar-nav ml-3"> <ul class="navbar-nav ml-3">
<li class="nav-item"> <li class="nav-item">
<a class="nav-link pointer" @click="logout"> <a class="nav-link pointer" @click="logout">
@ -112,6 +121,10 @@ export default {
logout() { logout() {
this.$emit('logout') this.$emit('logout')
}, },
admin() {
window.location = CONFIG.ADMIN_AUTH_URL.replace('$1',this.$store.state.token)
this.$store.dispatch('logout') // logout without redirect
},
getElopageLink() { getElopageLink() {
const pId = this.$store.state.publisherId const pId = this.$store.state.publisherId
? this.$store.state.publisherId ? this.$store.state.publisherId

View File

@ -18,8 +18,9 @@ const environment = {
DEFAULT_PUBLISHER_ID: process.env.DEFAULT_PUBLISHER_ID || 2896, DEFAULT_PUBLISHER_ID: process.env.DEFAULT_PUBLISHER_ID || 2896,
} }
const server = { const endpoints = {
GRAPHQL_URI: process.env.GRAPHQL_URI || 'http://localhost:4000/graphql', GRAPHQL_URI: process.env.GRAPHQL_URI || 'http://localhost:4000/graphql',
ADMIN_AUTH_URL: process.env.ADMIN_AUTH_URL || 'http://localhost/admin/authenticate?token=$1'
} }
const options = {} const options = {}
@ -27,7 +28,7 @@ const options = {}
const CONFIG = { const CONFIG = {
...version, ...version,
...environment, ...environment,
...server, ...endpoints,
...options, ...options,
} }

View File

@ -87,6 +87,7 @@ export const store = new Vuex.Store({
username: '', username: '',
description: '', description: '',
token: null, token: null,
isAdmin: true, // TODO implement this properly
coinanimation: true, coinanimation: true,
newsletterState: null, newsletterState: null,
community: { community: {