· 6 years ago · Sep 04, 2019, 12:58 PM
1<template>
2 <v-container fluid>
3 <v-text-field label="lalala" v-model="themeConfig"></v-text-field>
4 <v-btn color="primary" @click="submit">Primary</v-btn>
5 </v-container>
6</template>
7
8<script>
9import api from '@/api'
10
11export default {
12 name: 'ThemesAdmin',
13 methods: {
14 submit: function () {
15 api.school.updateConfig(this.$store.getters.selected_school, 'theme', {primary: this.themeConfig}).then(() => {
16 api.school.updateConfig(this.$store.getters.selected_school, 'theme', {primary: this.themeConfig})
17 })
18 // setting the primary color
19 this.$vuetify.theme.primary = this.$store.getters.schoolConfig.theme
20 console.log(this.$store.getters.schoolConfig.theme)
21 }
22 },
23 beforeMount: function () {
24 console.log(this.$store.getters.schoolConfig)
25 },
26 computed: {
27 themeConfig: {
28 get () { return (this.$store.getters.schoolConfig.theme) ? this.$store.getters.schoolConfig.theme : 1 },
29 set (value) { this.$store.commit('UPDATE_SCHOOL_CONFIG_KEY', { key: 'theme', value: value }) }
30 }
31 }
32}
33</script>
34
35<style lang='scss'>
36</style>