|
|
@@ -52,23 +52,23 @@ export default {
|
|
52
|
52
|
// Checks for type and fixes Episodes route edge case
|
|
53
|
53
|
return typeFromRoute(this.$route)
|
|
54
|
54
|
},
|
|
|
55
|
+ pType() {
|
|
|
56
|
+ const plural = this.type + 's'
|
|
|
57
|
+ return convertTitleCase(plural)
|
|
|
58
|
+ },
|
|
55
|
59
|
dispatchName() {
|
|
56
|
|
- let type = convertTitleCase(this.type) + 's'
|
|
57
|
|
- return this.sortBy ? `getAll${type.split('/')[0]}` : `getAll${type}`
|
|
|
60
|
+ return this.sortBy ? `getAll${this.pType.split('/')[0]}` : `getAll${this.pType}`
|
|
58
|
61
|
},
|
|
59
|
62
|
getMoreName() {
|
|
60
|
|
- let type = convertTitleCase(this.type) + 's'
|
|
61
|
|
- return this.sortBy ? `getMore${type.split('/')[0]}` : `getMore${type}`
|
|
|
63
|
+ return this.sortBy ? `getMore${this.pType.split('/')[0]}` : `getMore${this.pType}`
|
|
62
|
64
|
},
|
|
63
|
65
|
loaded() {
|
|
64
|
|
- let type = convertTitleCase(this.type) + 's'
|
|
65
|
|
- if (!type) return
|
|
66
|
|
- return this[`all${type}Loaded`]
|
|
|
66
|
+ if (!this.pType) return
|
|
|
67
|
+ return this[`all${this.pType}Loaded`]
|
|
67
|
68
|
},
|
|
68
|
69
|
posts() {
|
|
69
|
|
- let type = convertTitleCase(this.type) + 's'
|
|
70
|
|
- if (!type) return
|
|
71
|
|
- return this[`all${type}`]
|
|
|
70
|
+ if (!this.pType) return
|
|
|
71
|
+ return this[`all${this.pType}`]
|
|
72
|
72
|
},
|
|
73
|
73
|
},
|
|
74
|
74
|
methods: {
|
|
|
@@ -145,14 +145,14 @@ export default {
|
|
145
|
145
|
}, TIMEOUT)
|
|
146
|
146
|
},
|
|
147
|
147
|
setIntersectionLoader() {
|
|
148
|
|
- console.warn('setting up intersection handler...', this.type)
|
|
|
148
|
+ console.warn('setting up intersection handler for:', this.type)
|
|
149
|
149
|
window.removeEventListener("load", e => {}, false)
|
|
150
|
150
|
const footerEl = document.querySelector(".footer-wrapper footer")
|
|
151
|
|
- console.log('footer for intersection:', footerEl)
|
|
152
|
151
|
if(!footerEl) return
|
|
|
152
|
+
|
|
153
|
153
|
window.addEventListener("load", e => {
|
|
154
|
154
|
const observer = new IntersectionObserver(this.loadMorePosts, {
|
|
155
|
|
- rootMargin: "0px 0px 20px 0px",
|
|
|
155
|
+ rootMargin: "0px 0px -20px 0px",
|
|
156
|
156
|
})
|
|
157
|
157
|
observer.observe(footerEl)
|
|
158
|
158
|
}, false)
|
|
|
@@ -185,12 +185,11 @@ export default {
|
|
185
|
185
|
this.setIntersectionLoader()
|
|
186
|
186
|
},
|
|
187
|
187
|
created() {
|
|
188
|
|
- let type = convertTitleCase(this.type) + 's'
|
|
189
|
|
- this.checkAndSetHero(this.type)
|
|
|
188
|
+ this.checkAndSetHero(this.pType)
|
|
190
|
189
|
|
|
191
|
190
|
// We also need to check if only ONE has been loaded because
|
|
192
|
191
|
// coming from the homepage there will only be 1 item
|
|
193
|
|
- if (!this[`all${type}Loaded`] || this[`all${type}`].length < 2) this.getPosts(true)
|
|
|
192
|
+ if (!this[`all${this.pType}Loaded`] || this[`all${this.pType}`].length < 2) this.getPosts(true)
|
|
194
|
193
|
},
|
|
195
|
194
|
}
|
|
196
|
195
|
</script>
|