Refactor store management
This commit is contained in:
parent
8e49d0e0f2
commit
5ba15f8850
@ -20,10 +20,10 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
title() {
|
title() {
|
||||||
return this.$store.getters.ui.title;
|
return this.$store.state.ui.title;
|
||||||
},
|
},
|
||||||
backgroundColor() {
|
backgroundColor() {
|
||||||
return this.$store.getters.ui.backgroundColor;
|
return this.$store.state.ui.backgroundColor;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
/**
|
/**
|
||||||
* TODO: Do not open drawer on route change.
|
* TODO: Do not open drawer on route change nor on resize.
|
||||||
* TODO: Should stick to the toolbar on xs screens. Should be fixed by Vuetify 0.16.
|
* TODO: Should stick to the toolbar on xs screens. Should be fixed by Vuetify 0.16.
|
||||||
*/
|
*/
|
||||||
export default {
|
export default {
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
// TODO: Shouldn't we use mapState/mapGetters?
|
|
||||||
export default {
|
|
||||||
product: state => state.product,
|
|
||||||
isLoading: state => state.isLoading,
|
|
||||||
ui: state => state.ui,
|
|
||||||
};
|
|
@ -1,9 +1,7 @@
|
|||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import Vuex from 'vuex';
|
import Vuex from 'vuex';
|
||||||
import createLogger from 'vuex/dist/logger'; // TODO
|
|
||||||
|
|
||||||
import actions from './actions';
|
import actions from './actions';
|
||||||
import getters from './getters';
|
|
||||||
import { initialState as state, mutations } from './mutations';
|
import { initialState as state, mutations } from './mutations';
|
||||||
|
|
||||||
Vue.use(Vuex);
|
Vue.use(Vuex);
|
||||||
@ -11,7 +9,5 @@ Vue.use(Vuex);
|
|||||||
export default new Vuex.Store({
|
export default new Vuex.Store({
|
||||||
state,
|
state,
|
||||||
actions,
|
actions,
|
||||||
getters,
|
|
||||||
mutations,
|
mutations,
|
||||||
plugins: [createLogger()],
|
|
||||||
});
|
});
|
||||||
|
@ -67,12 +67,12 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
product() {
|
product() {
|
||||||
const product = this.$store.getters.product;
|
const product = this.$store.state.product;
|
||||||
this.$store.dispatch('setTitle', { title: product.product_name });
|
this.$store.dispatch('setTitle', { title: product.product_name });
|
||||||
return product;
|
return product;
|
||||||
},
|
},
|
||||||
isLoading() {
|
isLoading() {
|
||||||
return this.$store.getters.isLoading;
|
return this.$store.state.isLoading;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
Loading…
Reference in New Issue
Block a user