aboutsummaryrefslogtreecommitdiff
path: root/src/components/style_switcher/style_switcher.js
blob: d265572dd6024373e157631eadf922a6090fbff3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
export default {
  data () {
    return {
      availableStyles: [],
      selected: this.$store.state.config.theme
    }
  },
  created () {
    const self = this
    window.fetch('/static/css/themes.json')
      .then((data) => data.json())
      .then((themes) => { self.availableStyles = themes })
  },
  watch: {
    selected () {
      this.$store.dispatch('setOption', { name: 'theme', value: this.selected })
    }
  }
}