Skip to content

Instantly share code, notes, and snippets.

@PatrickKalkman
Created January 11, 2022 20:04
Show Gist options
  • Save PatrickKalkman/5183a22336e61fd08aa4a43d0e7d27eb to your computer and use it in GitHub Desktop.
Save PatrickKalkman/5183a22336e61fd08aa4a43d0e7d27eb to your computer and use it in GitHub Desktop.
<template>
<div>
<h1>Dashboard</h1>
<template v-if="!isLoading">
<CustomerCard
v-for="customer in customers"
:key="customer.id"
:customer="customer"
/>
</template>
<p v-else>Loading customers</p>
</div>
</template>
<script>
import CustomerCard from '@/components/CustomerCard';
export default {
components: { CustomerCard },
data() {
return {
isLoading: true,
customers: [],
};
},
created() {
this.$store
.dispatch('getCustomers')
.then(() => {
this.isLoading = false;
this.customers = this.$store.state.customers;
})
.catch((err) => {
this.isLoading = false;
console.log(err);
});
},
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment