Skip to content

Commit 450b0dc

Browse files
committed
Fixed dashboard conditional
1 parent 01b1e55 commit 450b0dc

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/views/Dashboard.vue

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
<template>
22
<div>
33
<h1>Dashboard</h1>
4-
<template v-if="events !== 'Loading events...'">
4+
<template v-if="!isLoading">
55
<EventCard v-for="event in events" :key="event.id" :event="event" />
66
</template>
7+
<p v-else>
8+
Loading events
9+
</p>
710
</div>
811
</template>
912

@@ -14,11 +17,15 @@ import EventCard from '../components/EventCard'
1417
export default {
1518
components: { EventCard },
1619
data () {
17-
return { events: 'Loading events...' }
20+
return {
21+
isLoading: true,
22+
events: []
23+
}
1824
},
1925
created () {
2026
axios.get('//localhost:3000/dashboard').then(({ data }) => {
2127
this.events = data.events.events
28+
this.isLoading = false
2229
})
2330
}
2431
}

0 commit comments

Comments
 (0)