hook up customer store to Customers page
This commit is contained in:
@@ -1,6 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<section class="section">
|
<section class="section">
|
||||||
<div class="container">
|
<div class="container" v-if="loading">
|
||||||
|
Loading...
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container" v-if="!loading">
|
||||||
<header class="is-clearfix">
|
<header class="is-clearfix">
|
||||||
<div class="control has-addons is-pulled-right">
|
<div class="control has-addons is-pulled-right">
|
||||||
<a class="button" :class="{ 'is-primary': mode === 'cards' }" @click="setMode('cards')">
|
<a class="button" :class="{ 'is-primary': mode === 'cards' }" @click="setMode('cards')">
|
||||||
@@ -33,6 +37,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { mapActions, mapState } from 'vuex';
|
||||||
import CustomerCard from '../components/CustomerCard.vue';
|
import CustomerCard from '../components/CustomerCard.vue';
|
||||||
import CustomerTable from '../components/CustomerTable.vue';
|
import CustomerTable from '../components/CustomerTable.vue';
|
||||||
import CustomerRow from '../components/CustomerRow.vue';
|
import CustomerRow from '../components/CustomerRow.vue';
|
||||||
@@ -55,20 +60,17 @@
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
mode: 'cards',
|
mode: 'cards',
|
||||||
customers: [
|
|
||||||
mockCustomer(1),
|
|
||||||
mockCustomer(2),
|
|
||||||
mockCustomer(3),
|
|
||||||
mockCustomer(4),
|
|
||||||
mockCustomer(5),
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
computed: Object.assign({}, mapState('customers', ['customers', 'loading'])),
|
||||||
|
methods: Object.assign({
|
||||||
setMode(mode) {
|
setMode(mode) {
|
||||||
this.mode = (mode === 'table') ? 'table' : 'cards';
|
this.mode = (mode === 'table') ? 'table' : 'cards';
|
||||||
}
|
},
|
||||||
}
|
}, mapActions('customers', ['fetchCustomers'])),
|
||||||
|
created() {
|
||||||
|
this.fetchCustomers();
|
||||||
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user