feat: add tag management feature
This commit is contained in:
parent
e284266b91
commit
e3fbebe1b8
17 changed files with 726 additions and 86 deletions
|
|
@ -1,14 +1,119 @@
|
|||
<template>
|
||||
<div>
|
||||
<h1>Admin Layout</h1>
|
||||
<div v-if="enabled">
|
||||
<v-app-bar
|
||||
app
|
||||
clipped-right
|
||||
color="blue-grey"
|
||||
dark
|
||||
>
|
||||
<v-app-bar-nav-icon @click.stop="drawer = !drawer"></v-app-bar-nav-icon>
|
||||
<v-toolbar-title>Administration</v-toolbar-title>
|
||||
<v-spacer></v-spacer>
|
||||
</v-app-bar>
|
||||
|
||||
<router-view></router-view>
|
||||
<v-navigation-drawer
|
||||
v-model="drawer"
|
||||
app
|
||||
>
|
||||
<v-list dense>
|
||||
<v-list-item exact :to="{ name: 'OrganizationList' }">
|
||||
<v-list-item-action>
|
||||
<v-icon>group</v-icon>
|
||||
</v-list-item-action>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title>Gérer les associations</v-list-item-title>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
<v-list-item exact :to="{ name: 'Tags' }">
|
||||
<v-list-item-action>
|
||||
<v-icon>label</v-icon>
|
||||
</v-list-item-action>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title>Gérer les tags/catégories</v-list-item-title>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-navigation-drawer>
|
||||
|
||||
<v-main>
|
||||
<v-container fluid>
|
||||
<router-view></router-view>
|
||||
</v-container>
|
||||
</v-main>
|
||||
</div>
|
||||
<v-main v-else>
|
||||
<div v-if="!enabled && loading">
|
||||
<span>Chargement...</span>
|
||||
</div>
|
||||
<div v-if="!enabled && !loading">
|
||||
<div class="d-flex align-center justify-center mt-5">
|
||||
<v-card>
|
||||
<v-card-title>
|
||||
Connexion au panel administrateur
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
<p>
|
||||
Vous n'êtes pas encore connecté à l'interface d'administration veuillez copier-coller le token dans la boîte ci-dessous.
|
||||
</p>
|
||||
<v-text-field autofocus label="Token" v-model="token" />
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer />
|
||||
<v-btn color="primary" @click="init" :disabled="token === ''">Se connecter</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</div>
|
||||
</div>
|
||||
</v-main>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
|
||||
data: () => ({
|
||||
drawer: null,
|
||||
left: false,
|
||||
enabled: false,
|
||||
loading: true,
|
||||
token: ''
|
||||
}),
|
||||
created () {
|
||||
this.init()
|
||||
},
|
||||
methods: {
|
||||
init () {
|
||||
this.enabled = false
|
||||
this.loading = true
|
||||
let adminToken = window.localStorage.getItem('adminToken')
|
||||
if (this.token !== '') {
|
||||
adminToken = this.token
|
||||
}
|
||||
if (adminToken === null || adminToken === 'null') {
|
||||
adminToken = (new URL(window.location)).searchParams.get('adminToken')
|
||||
if (adminToken === null) {
|
||||
// adminToken = prompt("Vous n'êtes pas encore connecté à l'interface d'administration veuillez copier-coller le token dans la boîte ci-dessous.")
|
||||
this.loading = false
|
||||
return
|
||||
}
|
||||
}
|
||||
this.$apitator.setAuthorizationToken(adminToken)
|
||||
// verify the token
|
||||
this.$apitator.get('/admin', { withAuth: true }).then(res => {
|
||||
window.localStorage.setItem('adminToken', adminToken)
|
||||
this.loading = false
|
||||
this.enabled = true
|
||||
}).catch(() => {
|
||||
this.loading = false
|
||||
if (this.token !== '') {
|
||||
this.$store.commit('ADD_ALERT', {
|
||||
color: 'error',
|
||||
text: 'Token invalide !'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,21 @@
|
|||
|
||||
<script>
|
||||
export default {
|
||||
|
||||
created() {
|
||||
let delegateToken = window.localStorage.getItem('delegateToken')
|
||||
if (delegateToken === null) {
|
||||
delegateToken = (new URL(window.location)).searchParams.get('delegateToken')
|
||||
if (delegateToken === null) {
|
||||
delegateToken = prompt(`
|
||||
Vous n'êtes pas encore connecté à l'interface de configuration de votre
|
||||
association veuillez copier-coller le token qui vous a été envoyé par email ci-dessous.
|
||||
(ou connectez vous directement avec le lient envoyé par email)
|
||||
`)
|
||||
}
|
||||
window.localStorage.setItem('delegateToken', delegateToken)
|
||||
}
|
||||
this.$apitator.setAuthorizationToken(delegateToken)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue