|
|
@@ -101,10 +101,13 @@ export default {
|
|
101
|
101
|
const dispatchAction = clear ? `getAll${this.pType}` : `getMore${this.pType}`
|
|
102
|
102
|
// pType sometimes is undefined so need to dispatch and
|
|
103
|
103
|
let res = null
|
|
|
104
|
+
|
|
104
|
105
|
// Episodes only needs load call
|
|
105
|
106
|
if(this.pType && dispatchAction != `getMoreEpisodes`) {
|
|
106
|
|
- console.log('d:', dispatchAction, this._getDispatchParams())
|
|
107
|
|
- res = await this.$store.dispatch(dispatchAction, this._getDispatchParams())
|
|
|
107
|
+ res = await this.$store.dispatch(
|
|
|
108
|
+ dispatchAction,
|
|
|
109
|
+ this._getDispatchParams()
|
|
|
110
|
+ )
|
|
108
|
111
|
}
|
|
109
|
112
|
|
|
110
|
113
|
// Stop trying to load more posts
|
|
|
@@ -139,13 +142,13 @@ export default {
|
|
139
|
142
|
setIntersectionLoader() {
|
|
140
|
143
|
console.warn('setting up intersection handler for:', this.type)
|
|
141
|
144
|
window.removeEventListener("load", e => {}, false)
|
|
142
|
|
- console.warn('all intersection handlers:', window)
|
|
|
145
|
+
|
|
143
|
146
|
const footerEl = document.querySelector(".footer-wrapper footer")
|
|
144
|
147
|
if(!footerEl) return
|
|
145
|
148
|
|
|
146
|
149
|
window.addEventListener("load", e => {
|
|
147
|
150
|
const observer = new IntersectionObserver(this.loadMorePosts, {
|
|
148
|
|
- rootMargin: "0px 0px -20px 0px",
|
|
|
151
|
+ rootMargin: "0px 0px 20px 0px",
|
|
149
|
152
|
})
|
|
150
|
153
|
observer.observe(footerEl)
|
|
151
|
154
|
}, false)
|
|
|
@@ -167,10 +170,12 @@ export default {
|
|
167
|
170
|
this.setIntersectionLoader()
|
|
168
|
171
|
},
|
|
169
|
172
|
},
|
|
170
|
|
- created() {
|
|
171
|
|
- console.log('--- List page ---')
|
|
|
173
|
+ mounted() {
|
|
172
|
174
|
this.setIntersectionLoader()
|
|
173
|
175
|
},
|
|
|
176
|
+ created() {
|
|
|
177
|
+ console.log('--- List page ---')
|
|
|
178
|
+ }
|
|
174
|
179
|
}
|
|
175
|
180
|
</script>
|
|
176
|
181
|
|