Files
noisedash/src/components/appbar.js
2022-04-11 16:16:28 -07:00

44 lines
925 B
JavaScript

export default {
name: 'AppBar',
data: () => ({
drawyer: false,
isAdmin: false,
loggedIn: false
}),
methods: {
home () {
this.$router.push('/')
},
account () {
this.$router.push('/account')
},
admin () {
this.$router.push('/admin')
},
logout () {
this.$http.get('/logout')
.then(response => {
if (response.status === 200) {
this.$router.push('/login')
}
})
},
getCurrentUser () {
this.loggedIn = false
this.drawyer = true
this.$http.get('/users/current')
.then(response => {
if (response.status === 200) {
this.loggedIn = true
this.isAdmin = response.data.user.isAdmin
this.$vuetify.theme.dark = response.data.user.darkMode
}
})
.catch(() => {
this.isAdmin = false
})
}
}
}