|
|
@@ -91,12 +91,6 @@ export default {
|
|
91
|
91
|
.filter(p => p)
|
|
92
|
92
|
.pop()
|
|
93
|
93
|
|
|
94
|
|
- // console.log('Gettings posts:', this.type)
|
|
95
|
|
- // if (!Object.values(sortTypes).includes(sort)) {
|
|
96
|
|
- // console.log('Sort not found:', sort)
|
|
97
|
|
- // sort = null
|
|
98
|
|
- // }
|
|
99
|
|
-
|
|
100
|
94
|
// Don't dispatch if there's no type
|
|
101
|
95
|
if (this.type && this.dispatchName && clear) {
|
|
102
|
96
|
this.$store.dispatch(
|
|
|
@@ -146,11 +140,9 @@ export default {
|
|
146
|
140
|
page => page.slug == type + 's',
|
|
147
|
141
|
)[0]
|
|
148
|
142
|
|
|
149
|
|
-
|
|
150
|
143
|
// Clear the hero and bail
|
|
151
|
144
|
if(!page) return this.clearHero()
|
|
152
|
145
|
|
|
153
|
|
- console.log('setting hero:', page)
|
|
154
|
146
|
let hero = { url: page.featured, heroType:'image' }
|
|
155
|
147
|
if (
|
|
156
|
148
|
page.hero &&
|
|
|
@@ -187,24 +179,16 @@ export default {
|
|
187
|
179
|
}
|
|
188
|
180
|
},
|
|
189
|
181
|
watch: {
|
|
190
|
|
- $route(to, from) {
|
|
191
|
|
- // Only grab the hero if moving to another list page
|
|
192
|
|
- console.log(to.fullPath.split('/'))
|
|
193
|
|
- if (to.fullPath.split('/').filter(p => p).length <= 1) {
|
|
|
182
|
+ $route(to) {
|
|
|
183
|
+ // Filter the path to remove blank strings and
|
|
|
184
|
+ // only grab the hero if moving to another list page
|
|
|
185
|
+ // eg. list page -> list page
|
|
|
186
|
+ const path = to.fullPath.split('/').filter(p => p)
|
|
|
187
|
+ if (path.length <= 1) {
|
|
194
|
188
|
this.clearHero()
|
|
195
|
189
|
this.checkAndSetHero(this.type)
|
|
196
|
190
|
}
|
|
197
|
191
|
|
|
198
|
|
- let sort = to.path
|
|
199
|
|
- .split('/')
|
|
200
|
|
- .filter(p => p)
|
|
201
|
|
- .pop()
|
|
202
|
|
-
|
|
203
|
|
- if (!Object.values(sortTypes).includes(sort)) {
|
|
204
|
|
- // console.warn('sort not found:', sort)
|
|
205
|
|
- sort = null
|
|
206
|
|
- }
|
|
207
|
|
-
|
|
208
|
192
|
// TODO: Track last loaded page per post type
|
|
209
|
193
|
// Less http calls
|
|
210
|
194
|
this.page = 1
|