|
|
@@ -46,7 +46,7 @@ import gallery from '@/components/gallery/'
|
|
46
|
46
|
import credits from '@/components/credits'
|
|
47
|
47
|
import breadcrumb from '@/components/breadcrumb'
|
|
48
|
48
|
|
|
49
|
|
-import { postTypeGetters, stateHelper, scrollTop } from './mixin-post-types'
|
|
|
49
|
+import { postTypeGetters, scrollTop, heroUtils } from './mixin-post-types'
|
|
50
|
50
|
|
|
51
|
51
|
import { convertTitleCase, dePluralize, typeFromRoute } from '@/utils/helpers'
|
|
52
|
52
|
|
|
|
@@ -168,7 +168,8 @@ export default {
|
|
168
|
168
|
* @param {object} posts
|
|
169
|
169
|
*/
|
|
170
|
170
|
checkAndSetHero(post) {
|
|
171
|
|
- if (!post) return
|
|
|
171
|
+ this._clearHero(this.$store)
|
|
|
172
|
+ if (!post) return console.warn(`no post found`)
|
|
172
|
173
|
this.$store.commit('SET_HERO', this._setHeroInfo(post))
|
|
173
|
174
|
},
|
|
174
|
175
|
|
|
|
@@ -183,7 +184,6 @@ export default {
|
|
183
|
184
|
/**
|
|
184
|
185
|
* Conditionally load based on post type
|
|
185
|
186
|
* which is derived from the route
|
|
186
|
|
- * !: posts watcher fires when this finishes
|
|
187
|
187
|
*/
|
|
188
|
188
|
// modules are NOT plural because module key
|
|
189
|
189
|
if (!this.$store.state[this.type]) return
|
|
|
@@ -217,21 +217,8 @@ export default {
|
|
217
|
217
|
)
|
|
218
|
218
|
this.loading = false
|
|
219
|
219
|
},
|
|
220
|
|
-
|
|
221
|
|
- scrollTo(hashtag) {
|
|
222
|
|
- setTimeout(() => {
|
|
223
|
|
- location.href = hashtag
|
|
224
|
|
- }, TIMEOUT)
|
|
225
|
|
- },
|
|
226
|
220
|
},
|
|
227
|
221
|
watch: {
|
|
228
|
|
- post(newVal, oldVal) {
|
|
229
|
|
- // Prevent loading single post when
|
|
230
|
|
- // navigating AWAY from the page
|
|
231
|
|
- // if (!oldVal) {
|
|
232
|
|
- // this.checkAndSetHero(newVal)
|
|
233
|
|
- // }
|
|
234
|
|
- },
|
|
235
|
222
|
$route(to, from) {
|
|
236
|
223
|
// Only load post data when
|
|
237
|
224
|
// navigating TO a single page
|
|
|
@@ -242,11 +229,6 @@ export default {
|
|
242
|
229
|
}
|
|
243
|
230
|
},
|
|
244
|
231
|
},
|
|
245
|
|
- mounted() {
|
|
246
|
|
- // if (this.$route.hash) {
|
|
247
|
|
- // setTimeout(() => this.scrollTo(this.$route.hash), TIMEOUT)
|
|
248
|
|
- // }
|
|
249
|
|
- },
|
|
250
|
232
|
created() {
|
|
251
|
233
|
this.loadPostData()
|
|
252
|
234
|
},
|