diff options
-rw-r--r-- | resources/js/components/call-sign-filter.vue | 18 | ||||
-rw-r--r-- | resources/js/store.js | 8 |
2 files changed, 17 insertions, 9 deletions
diff --git a/resources/js/components/call-sign-filter.vue b/resources/js/components/call-sign-filter.vue index 9ad202d..658b0d2 100644 --- a/resources/js/components/call-sign-filter.vue +++ b/resources/js/components/call-sign-filter.vue @@ -9,18 +9,20 @@ import store from '../store.js'; export default { - data() { - return { - selected: store.state.selectedSign, - //options: store.state.callSigns - } - }, mounted() { - store.dispatch('getSigns'); + store.dispatch('fillSigns'); }, computed: { + selected: { + get() { + return store.getters.getSelectedSign; + }, + set(value) { + store.dispatch('setSelectedSign', value); + } + }, options() { - return store.state.callSigns; + return store.getters.getSigns; } } } diff --git a/resources/js/store.js b/resources/js/store.js index 7f5f1df..33b7469 100644 --- a/resources/js/store.js +++ b/resources/js/store.js @@ -17,12 +17,18 @@ const store = new Vuex.Store({ } }, mutations: { + setSelectedSign(state, sign) { + state.selectedSign = sign; + }, fillSigns(state, signs) { state.callSigns = signs; } }, actions: { - getSigns(context) { + setSelectedSign(context, sign) { + context.commit('setSelectedSign', sign); + }, + fillSigns(context) { let data = ['test', 'TEST', 'TeSt']; context.commit('fillSigns', data); } |