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

53 lines
1.4 KiB
Vue
Raw Normal View History

2022-05-03 14:52:04 +02:00
<template>
<div v-if="isLoading" class="circle">
<i class="fa fa-spinner fa-spin fa-3x fa-fw"></i>
<span class="sr-only">Loading </span>
</div>
2022-05-06 13:52:18 +02:00
<div v-else class="mt-1 mb-1">
2022-05-03 14:52:04 +02:00
<b-link class="align-left blog-details" :to="'/profile/' + author.username">
<img class="article-author-img rounded-circle"
:src="'build/images/' + author.avatar"
alt="profile"></b-link>
<b-link :to="'/profile/' + author.username">
{{ author.username }}
</b-link>
</div>
</template>
<script>
import axios from "axios";
export default {
name: "Author",
data: () => ({
author: null,
isLoading: true
}),
props: ["authorIri"],
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>