Add profile deletion, hide admin page to non-admins

This commit is contained in:
Kevin Thomas
2021-08-07 23:46:20 -07:00
parent cb1904ec2f
commit cd6af207be
7 changed files with 137 additions and 21 deletions

View File

@@ -7,7 +7,7 @@
dense
>
<v-app-bar-nav-icon
@click="drawyer = true"
@click="openDrawyer"
/>
</v-app-bar>
<v-navigation-drawer
@@ -31,6 +31,17 @@
Home
</v-list-item-title>
</v-list-item>
<v-list-item
v-if="isAdmin"
@click="admin"
>
<v-list-item-icon>
<v-icon>mdi-database-cog</v-icon>
</v-list-item-icon>
<v-list-item-title>
Admin
</v-list-item-title>
</v-list-item>
<v-list-item
@click="logout"
>
@@ -59,7 +70,8 @@ export default {
data: () => ({
drawyer: false,
group: null
group: null,
isAdmin: false
}),
methods: {
home () {
@@ -78,6 +90,21 @@ export default {
.catch(function (error) {
console.error(error.response)
})
},
openDrawyer () {
this.$http.get('https://localhost:3000/users/current')
.then(response => {
if (response.data.user.isAdmin) {
this.isAdmin = true
} else {
this.isAdmin = false
}
})
.catch(function (error) {
console.error(error.response)
this.isAdmin = false
})
this.drawyer = true
}
}
}