aboutsummaryrefslogtreecommitdiff
path: root/src/components/style_switcher/style_switcher.js
blob: 8a8cc2a0cccb7407ae8ce8a7603fd5ff2c59fae7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import StyleSetter from '../../services/style_setter/style_setter.js'

export default {
  data: () => ({
    availableStyles: [],
    selected: false
  }),
  created () {
    const self = this
    window.fetch('/static/css/themes.json')
      .then((data) => data.json())
      .then((themes) => { self.availableStyles = themes })
  },
  watch: {
    selected () {
      const fullPath = `/static/css/${this.selected}`
      StyleSetter.setStyle(fullPath)
    }
  }
}