46 lines
881 B
Vue
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>
|