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

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

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

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

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