From fe2fe092361b60c9d585f80b53d906b501c9722e Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Tue, 11 Dec 2018 01:38:20 +0300 Subject: fixed v2 setting as default theme --- src/components/style_switcher/style_switcher.js | 34 +++---------------------- 1 file changed, 4 insertions(+), 30 deletions(-) (limited to 'src/components') diff --git a/src/components/style_switcher/style_switcher.js b/src/components/style_switcher/style_switcher.js index d09185fa..2bbf74db 100644 --- a/src/components/style_switcher/style_switcher.js +++ b/src/components/style_switcher/style_switcher.js @@ -1,6 +1,6 @@ import { rgb2hex, hex2rgb, getContrastRatio, alphaBlend } from '../../services/color_convert/color_convert.js' import { set, delete as del } from 'vue' -import { generateColors, generateShadows, generateRadii, generateFonts, composePreset } from '../../services/style_setter/style_setter.js' +import { generateColors, generateShadows, generateRadii, generateFonts, composePreset, getThemes } from '../../services/style_setter/style_setter.js' import ColorInput from '../color_input/color_input.vue' import RangeInput from '../range_input/range_input.vue' import OpacityInput from '../opacity_input/opacity_input.vue' @@ -104,35 +104,9 @@ export default { created () { const self = this - window.fetch('/static/styles.json') - .then((data) => data.json()) - .then((themes) => { - return Promise.all(Object.entries(themes).map(([k, v]) => { - if (typeof v === 'object') { - return Promise.resolve([k, v]) - } else if (typeof v === 'string') { - return window.fetch(v) - .then((data) => data.json()) - .then((theme) => { - return [k, theme] - }) - .catch((e) => { - console.error(e) - return [] - }) - } - })) - }) - .then((promises) => { - return promises - .filter(([k, v]) => v) - .reduce((acc, [k, v]) => { - acc[k] = v - return acc - }, {}) - }).then((themesComplete) => { - self.availableStyles = themesComplete - }) + getThemes().then((themesComplete) => { + self.availableStyles = themesComplete + }) }, mounted () { this.normalizeLocalState(this.$store.state.config.customTheme) -- cgit v1.2.3-70-g09d2