Просмотр исходного кода

:recycle: swapping page retrieval on welcome

tags/0.9.0
J 4 лет назад
Родитель
Сommit
e2447e9b80
2 измененных файлов: 7 добавлений и 5 удалений
  1. 5
    4
      vue-theme/src/pages/index.vue
  2. 2
    1
      vue-theme/src/pages/list.vue

+ 5
- 4
vue-theme/src/pages/index.vue Просмотреть файл

@@ -50,7 +50,7 @@ export default {
50 50
     },
51 51
     async created() {
52 52
         // console.log(wp)
53
-        const omit = ['event', 'exhibition', 'page']
53
+        const omit = ['page']
54 54
         for (let type of postTypes) {
55 55
             const action = `getAll${convertTitleCase(type)}s`
56 56
 
@@ -60,9 +60,7 @@ export default {
60 60
             
61 61
             // We try and fetch EVERYTHING except
62 62
             // for EVENTS and EXHIBITIONS
63
-            if (!omit.includes(type)) {
64
-                this.$store.dispatch(action, { sortType: null, params })
65
-            } else {
63
+            if (['event', 'exhibition'].includes(type)) {
66 64
                 // Only grab the current or upcoming on load
67 65
                 const eventsOrExhibitions = await this.$store.dispatch(
68 66
                     action,
@@ -77,6 +75,9 @@ export default {
77 75
                     this.$store.dispatch(action, { sortType: sortTypes.past, params })
78 76
                 }
79 77
             }
78
+            else if (!omit.includes(type)){
79
+                this.$store.dispatch(action, { sortType: null, params })
80
+            }
80 81
         }
81 82
         if (!this['allPagesLoaded']) {
82 83
             await this.$store.dispatch('getAllPages', { sortType: null, params: null })

+ 2
- 1
vue-theme/src/pages/list.vue Просмотреть файл

@@ -138,6 +138,7 @@ export default {
138 138
             // We always set a hero no matter what
139 139
             // Because the hero component will deal
140 140
             // with how to render based on hero.url
141
+            if(!this.allPages) return console.log('no pages in state', this)
141 142
             const page = this.allPages.filter(
142 143
                 page => page.slug == type + 's',
143 144
             )[0]
@@ -185,7 +186,7 @@ export default {
185 186
     watch: {
186 187
         $route(to, from) {
187 188
             this.checkAndSetHero(this.type)
188
-            
189
+
189 190
             let sort = to.path
190 191
                 .split('/')
191 192
                 .filter(p => p)

Загрузка…
Отмена
Сохранить