storyboard-vue/src/components/EventComment.vue
Adam Coldrick fa0bee29d1 Add an initial Events Timeline for Stories
This doesn't cover all the possible events yet, but is a sufficient
starting point.
2020-05-06 01:36:48 +01:00

46 lines
881 B
Vue

<template>
<div class="event-details">
<p class="event-title">
<a href="">{{ author.full_name }}</a>
commented on {{ createdDate.toDateString() }}
at {{ createdDate.toLocaleTimeString() }}
</p>
<div class="event-body">
{{ event.comment.content }}
</div>
</div>
</template>
<script>
import axios from 'axios'
export default {
name: 'EventComment',
data () {
return {
author: {}
}
},
props: ['event'],
computed: {
createdDate () {
return new Date(this.event.created_at)
}
},
created () {
this.getAuthor(this.event.author_id)
},
methods: {
async getAuthor (authorId) {
const baseUrl = 'http://localhost:8080/v1'
const { data: author } = await axios.get(`${baseUrl}/users/${authorId}`)
this.author = author
}
}
}
</script>
<style lang="scss" scoped>
</style>