-
Notifications
You must be signed in to change notification settings - Fork 21
/
_id.vue
92 lines (85 loc) · 2 KB
/
_id.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<template>
<section class="author">
<ContainerList
:fetchList="fetchList"
:listTitle="authorName"
:listTitleColor="isPremiumMember ? '#000000de' : '#bcbcbc'"
/>
<UiStickyAd pageKey="other" />
<ContainerFullScreenAds />
</section>
</template>
<script>
import ContainerList from '~/components/ContainerList.vue'
import ContainerFullScreenAds from '~/components/ContainerFullScreenAds.vue'
import UiStickyAd from '~/components/UiStickyAd.vue'
import { SITE_TITLE, SITE_URL } from '~/constants'
export default {
name: 'Author',
components: {
ContainerList,
ContainerFullScreenAds,
UiStickyAd,
},
async fetch() {
const authorResponse = await this.fetchAuthor()
this.setAuthorName(authorResponse)
},
data() {
return {
authorName: undefined,
}
},
computed: {
isPremiumMember() {
return this.$store?.getters?.['membership-subscribe/isPremiumMember']
},
authorId() {
return this.$route.params.id
},
},
methods: {
async fetchList(page) {
return await this.$fetchPostsFromMembershipGateway({
maxResults: 9,
sort: '-publishedDate',
$or: [
{ writers: this.authorId },
{ photographers: this.authorId },
{ camera_man: this.authorId },
{ designers: this.authorId },
{ engineers: this.authorId },
],
page,
})
},
async fetchAuthor() {
const response = await this.$fetchContacts({
id: this.authorId,
})
return response
},
setAuthorName(response = {}) {
this.authorName = response.items?.[0]?.name
},
},
head() {
const title = `${this.authorName} - ${SITE_TITLE}`
return {
title,
meta: [
{
hid: 'og:title',
name: 'og:title',
content: title,
},
{
hid: 'og:url',
property: 'og:url',
content: `${SITE_URL}/author/${this.authorId}`,
},
],
}
},
}
</script>