Update widget colors based on the widgetConfig (#276)
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
import Vue from 'vue';
|
||||
import Vuex from 'vuex';
|
||||
import conversation from 'widget/store/modules/conversation';
|
||||
import appConfig from 'widget/store/modules/appConfig';
|
||||
|
||||
Vue.use(Vuex);
|
||||
|
||||
export default new Vuex.Store({
|
||||
modules: {
|
||||
appConfig,
|
||||
conversation,
|
||||
},
|
||||
});
|
||||
|
||||
29
app/javascript/widget/store/modules/appConfig.js
Normal file
29
app/javascript/widget/store/modules/appConfig.js
Normal file
@@ -0,0 +1,29 @@
|
||||
import { SET_WIDGET_COLOR } from '../types';
|
||||
|
||||
const state = {
|
||||
widgetColor: '',
|
||||
};
|
||||
|
||||
const getters = {
|
||||
getWidgetColor: $state => $state.widgetColor,
|
||||
};
|
||||
|
||||
const actions = {
|
||||
setWidgetColor({ commit }, data) {
|
||||
commit(SET_WIDGET_COLOR, data);
|
||||
},
|
||||
};
|
||||
|
||||
const mutations = {
|
||||
[SET_WIDGET_COLOR]($state, data) {
|
||||
$state.widgetColor = data.widget_color;
|
||||
},
|
||||
};
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state,
|
||||
getters,
|
||||
actions,
|
||||
mutations,
|
||||
};
|
||||
1
app/javascript/widget/store/types.js
Normal file
1
app/javascript/widget/store/types.js
Normal file
@@ -0,0 +1 @@
|
||||
export const SET_WIDGET_COLOR = 'SET_WIDGET_COLOR';
|
||||
Reference in New Issue
Block a user