Spookie/assets/js/components/users/UserCard.vue

68 lines
1.1 KiB
Vue
Raw Normal View History

2022-05-03 14:52:04 +02:00
<template>
2022-05-11 14:48:04 +02:00
<div
v-if="isLoading"
class="circle"
>
<i class="fa fa-spinner fa-spin fa-3x fa-fw"/>
<span class="sr-only">Loading </span>
</div>
<div
v-else
class="mt-1 mb-1"
>
<router-link
class="align-left blog-details"
:to="'/profile/' + author.username"
>
<img
class="article-author-img rounded-circle"
:src="'build/images/' + author.avatar"
alt="profile"
>
</router-link>
<router-link :to="'/profile/' + author.username">
{{ author.username }}
</router-link>
</div>
2022-05-03 14:52:04 +02:00
</template>
<script>
2022-05-11 14:48:04 +02:00
import axios from 'axios'
2022-05-03 14:52:04 +02:00
export default {
2022-05-11 14:48:04 +02:00
name: 'UserCard',
props: {
authorIri: {
type: String,
required: true
}
},
data: () => ({
author: null,
isLoading: true
}),
mounted() {
this.getAuthor()
},
methods: {
getAuthor() {
console.log(`here${this.authorIri}`)
axios
.get(this.authorIri)
.then((response) => {
console.log('response')
console.log(response)
this.author = response.data
console.log(this.author)
this.isLoading = false
})
.catch((error) => {
console.log(error)
})
console.log(this.author)
}
}
}
</script>