Add sample support, re-organize repo

This commit is contained in:
Kevin Thomas
2021-09-24 00:35:18 -07:00
parent b9e340c26a
commit f2d1b80673
23 changed files with 703 additions and 524 deletions

51
src/components/appbar.js Normal file
View File

@@ -0,0 +1,51 @@
export default {
name: 'AppBar',
data: () => ({
drawyer: false,
isAdmin: false
}),
created () {
this.getCurrentUser()
},
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.$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)
})
}
}
}