|
|
@@ -53,6 +53,7 @@ export default {
|
|
53
|
53
|
return typeFromRoute(this.$route)
|
|
54
|
54
|
},
|
|
55
|
55
|
pType() {
|
|
|
56
|
+ if(!this.type) return
|
|
56
|
57
|
console.log(this.type, `${convertTitleCase(this.type)}s`)
|
|
57
|
58
|
return this.sortBy ? `${convertTitleCase(this.type.split('/')[0])}s` : `${convertTitleCase(this.type)}s`
|
|
58
|
59
|
},
|
|
|
@@ -105,6 +106,8 @@ export default {
|
|
105
|
106
|
this.$store.commit('SET_HERO', { url: null, heroType: null })
|
|
106
|
107
|
},
|
|
107
|
108
|
async checkAndSetHero(type) {
|
|
|
109
|
+ this.clearHero()
|
|
|
110
|
+
|
|
108
|
111
|
if (!this['allPagesLoaded']) {
|
|
109
|
112
|
await this.$store.dispatch('getAllPages', { sortType: null, params: null })
|
|
110
|
113
|
}
|
|
|
@@ -117,9 +120,6 @@ export default {
|
|
117
|
120
|
page => page.slug == type + 's',
|
|
118
|
121
|
)[0]
|
|
119
|
122
|
|
|
120
|
|
- // Clear the hero and bail
|
|
121
|
|
- if(!page) return this.clearHero()
|
|
122
|
|
-
|
|
123
|
123
|
let json = { url: page.featured, heroType:'image' }
|
|
124
|
124
|
if (
|
|
125
|
125
|
page.hero &&
|
|
|
@@ -135,11 +135,6 @@ export default {
|
|
135
|
135
|
json.text = page && page.excerpt ? page.excerpt : page.title
|
|
136
|
136
|
this.$store.commit('SET_HERO', json)
|
|
137
|
137
|
},
|
|
138
|
|
- scrollTo(hashtag) {
|
|
139
|
|
- setTimeout(() => {
|
|
140
|
|
- location.href = hashtag
|
|
141
|
|
- }, TIMEOUT)
|
|
142
|
|
- },
|
|
143
|
138
|
setIntersectionLoader() {
|
|
144
|
139
|
console.warn('setting up intersection handler for:', this.type)
|
|
145
|
140
|
window.removeEventListener("load", e => {}, false)
|
|
|
@@ -165,21 +160,18 @@ export default {
|
|
165
|
160
|
console.log('?:', path.pop())
|
|
166
|
161
|
|
|
167
|
162
|
// Always reset the page count
|
|
168
|
|
- this.setIntersectionLoader()
|
|
169
|
163
|
this.page = 1
|
|
170
|
164
|
|
|
171
|
|
- this.clearHero()
|
|
172
|
165
|
this.checkAndSetHero(this.type)
|
|
173
|
166
|
|
|
174
|
167
|
// TODO: Track last loaded page per post type
|
|
175
|
168
|
// Less http calls
|
|
176
|
169
|
this.getPosts(true)
|
|
|
170
|
+
|
|
|
171
|
+ this.setIntersectionLoader()
|
|
177
|
172
|
},
|
|
178
|
173
|
},
|
|
179
|
174
|
mounted() {
|
|
180
|
|
- if (this.$route.hash) {
|
|
181
|
|
- setTimeout(() => this.scrollTo(this.$route.hash), TIMEOUT)
|
|
182
|
|
- }
|
|
183
|
175
|
this.setIntersectionLoader()
|
|
184
|
176
|
},
|
|
185
|
177
|
created() {
|