mirror of
https://github.com/kaythomas0/noisedash.git
synced 2025-11-14 04:14:02 +00:00
50 lines
1.1 KiB
JavaScript
50 lines
1.1 KiB
JavaScript
export default {
|
|
name: 'AppBar',
|
|
|
|
data: () => ({
|
|
drawyer: false,
|
|
isAdmin: false
|
|
}),
|
|
methods: {
|
|
home () {
|
|
this.$router.push('/')
|
|
},
|
|
admin () {
|
|
this.$router.push('/admin')
|
|
},
|
|
logout () {
|
|
this.$http.get('/logout')
|
|
.then(response => {
|
|
if (response.status === 200) {
|
|
this.$router.push('/login')
|
|
}
|
|
})
|
|
.catch((error) => {
|
|
console.error(error.response)
|
|
})
|
|
},
|
|
getCurrentUser () {
|
|
this.drawyer = true
|
|
this.$http.get('/users/current')
|
|
.then(response => {
|
|
if (response.status === 200) {
|
|
this.isAdmin = response.data.user.isAdmin
|
|
this.$vuetify.theme.dark = response.data.user.darkMode
|
|
}
|
|
})
|
|
.catch((error) => {
|
|
console.error(error.response)
|
|
this.isAdmin = false
|
|
})
|
|
},
|
|
toggleDarkMode () {
|
|
this.$http.patch('/users/dark-mode', {
|
|
darkMode: this.$vuetify.theme.dark
|
|
})
|
|
.catch((error) => {
|
|
console.error(error.response)
|
|
})
|
|
}
|
|
}
|
|
}
|