|
|
@@ -130,6 +130,9 @@ export default {
|
|
130
|
130
|
)
|
|
131
|
131
|
}
|
|
132
|
132
|
},
|
|
|
133
|
+ clearHero() {
|
|
|
134
|
+ this.$store.commit('SET_HERO', { url: null, heroType: null })
|
|
|
135
|
+ },
|
|
133
|
136
|
async checkAndSetHero(type) {
|
|
134
|
137
|
if (!this['allPagesLoaded']) {
|
|
135
|
138
|
await this.$store.dispatch('getAllPages', { sortType: null, params: null })
|
|
|
@@ -143,14 +146,12 @@ export default {
|
|
143
|
146
|
page => page.slug == type + 's',
|
|
144
|
147
|
)[0]
|
|
145
|
148
|
|
|
146
|
|
- let hero = { url: null, heroType: null }
|
|
147
|
149
|
|
|
148
|
150
|
// Clear the hero and bail
|
|
149
|
|
- if(!page) return this.$store.commit('SET_HERO', hero)
|
|
|
151
|
+ if(!page) return this.clearHero()
|
|
150
|
152
|
|
|
151
|
153
|
console.log('setting hero:', page)
|
|
152
|
|
- hero.url = page.featured
|
|
153
|
|
- hero.heroType = 'image'
|
|
|
154
|
+ let hero = { url: page.featured, heroType:'image' }
|
|
154
|
155
|
if (
|
|
155
|
156
|
page.hero &&
|
|
156
|
157
|
JSON.parse(page.hero) &&
|
|
|
@@ -187,9 +188,11 @@ export default {
|
|
187
|
188
|
},
|
|
188
|
189
|
watch: {
|
|
189
|
190
|
$route(to, from) {
|
|
190
|
|
- console.log('to:', to)
|
|
191
|
|
- console.log('from:', from)
|
|
192
|
|
- this.checkAndSetHero(this.type)
|
|
|
191
|
+ // Only grab the hero if moving to another list page
|
|
|
192
|
+ if (to.fullPath.split('/').filter(p => p).length < 1) {
|
|
|
193
|
+ this.clearHero()
|
|
|
194
|
+ this.checkAndSetHero(this.type)
|
|
|
195
|
+ }
|
|
193
|
196
|
|
|
194
|
197
|
let sort = to.path
|
|
195
|
198
|
.split('/')
|