Commit 3e426c52 authored by Enrique Alcantara's avatar Enrique Alcantara

Use namespaced helpers for actions

parent 6cb9af8c
...@@ -6,9 +6,13 @@ import RegionDropdown from './region_dropdown.vue'; ...@@ -6,9 +6,13 @@ import RegionDropdown from './region_dropdown.vue';
import RoleNameDropdown from './role_name_dropdown.vue'; import RoleNameDropdown from './role_name_dropdown.vue';
import SecurityGroupDropdown from './security_group_dropdown.vue'; import SecurityGroupDropdown from './security_group_dropdown.vue';
const { mapState: mapRegionsState } = createNamespacedHelpers('regions'); const { mapState: mapRegionsState, mapActions: mapRegionsActions } = createNamespacedHelpers(
const { mapState: mapVpcsState } = createNamespacedHelpers('vpcs'); 'regions',
const { mapState: mapSubnetsState } = createNamespacedHelpers('subnets'); );
const { mapState: mapVpcsState, mapActions: mapVpcActions } = createNamespacedHelpers('vpcs');
const { mapState: mapSubnetsState, mapActions: mapSubnetActions } = createNamespacedHelpers(
'subnets',
);
export default { export default {
components: { components: {
...@@ -72,11 +76,9 @@ export default { ...@@ -72,11 +76,9 @@ export default {
}, },
methods: { methods: {
...mapActions(['setRegion', 'setVpc', 'setSubnet']), ...mapActions(['setRegion', 'setVpc', 'setSubnet']),
...mapActions({ ...mapRegionsActions({ fetchRegions: 'fetchItems' }),
fetchRegions: 'regions/fetchItems', ...mapVpcActions({ fetchVpcs: 'fetchItems' }),
fetchVpcs: 'vpcs/fetchItems', ...mapSubnetActions({ fetchSubnets: 'fetchItems' }),
fetchSubnets: 'subnets/fetchItems',
}),
setRegionAndFetchVpcs(region) { setRegionAndFetchVpcs(region) {
this.setRegion({ region }); this.setRegion({ region });
this.fetchVpcs({ region }); this.fetchVpcs({ region });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment