Pārlūkot izejas kodu

:recycle: moving sort and dispatch params | adding some logs | set fetch flag on watcher

tags/0.9.0
J 4 gadus atpakaļ
vecāks
revīzija
a7015352f4
2 mainītis faili ar 16 papildinājumiem un 15 dzēšanām
  1. 15
    14
      vue-theme/src/pages/list.vue
  2. 1
    1
      vue-theme/src/utils/helpers.js

+ 15
- 14
vue-theme/src/pages/list.vue Parādīt failu

9
                     h3 sorted {{ sortBy.replace('-', ' ') }}
9
                     h3 sorted {{ sortBy.replace('-', ' ') }}
10
 
10
 
11
             h3(v-if="!loaded") loading...
11
             h3(v-if="!loaded") loading...
12
-            .content(v-else-if="allPagesLoaded && type && allPages[type]" v-html="allPages[type].content")
12
+            .content(
13
+                v-else-if="allPagesLoaded && type && allPages[type]"
14
+                v-html="allPages[type].content"
15
+            )
13
 
16
 
14
         .posts(v-if="posts && loaded" :class="{ 'is-grid': grid }")
17
         .posts(v-if="posts && loaded" :class="{ 'is-grid': grid }")
15
             section(v-for="(post, i) in posts" :key="post.slug").shadow.post
18
             section(v-for="(post, i) in posts" :key="post.slug").shadow.post
97
         async getPosts({ clear }) {
100
         async getPosts({ clear }) {
98
             const dispatchAction = clear ? `getAll${this.pType}` : `getMore${this.pType}`
101
             const dispatchAction = clear ? `getAll${this.pType}` : `getMore${this.pType}`
99
             // pType sometimes is undefined so need to dispatch and
102
             // pType sometimes is undefined so need to dispatch and
100
-            // Episodes only needs load call
101
             let res = null
103
             let res = null
104
+            // Episodes only needs load call
102
             if(this.pType && dispatchAction != `getMoreEpisodes`) {
105
             if(this.pType && dispatchAction != `getMoreEpisodes`) {
103
                 console.log('d:', dispatchAction, this._getDispatchParams())
106
                 console.log('d:', dispatchAction, this._getDispatchParams())
104
                 res = await this.$store.dispatch(dispatchAction, this._getDispatchParams())
107
                 res = await this.$store.dispatch(dispatchAction, this._getDispatchParams())
116
             this._clearHero(this.$store)
119
             this._clearHero(this.$store)
117
 
120
 
118
             if (!this['allPagesLoaded']) {
121
             if (!this['allPagesLoaded']) {
119
-                await this.$store.dispatch('getAllPages', { sortType: null, params: null })
122
+                await this.$store.dispatch('getAllPages', {
123
+                    sortType: null,
124
+                    params: null
125
+                })
120
             }
126
             }
121
 
127
 
122
             // We always set a hero no matter what
128
             // We always set a hero no matter what
133
         setIntersectionLoader() {
139
         setIntersectionLoader() {
134
             console.warn('setting up intersection handler for:', this.type)
140
             console.warn('setting up intersection handler for:', this.type)
135
             window.removeEventListener("load", e => {}, false)
141
             window.removeEventListener("load", e => {}, false)
142
+            console.warn('all intersection handlers:', window)
136
             const footerEl = document.querySelector(".footer-wrapper footer")
143
             const footerEl = document.querySelector(".footer-wrapper footer")
137
             if(!footerEl) return
144
             if(!footerEl) return
138
 
145
 
146
     },
153
     },
147
     watch: {
154
     watch: {
148
         $route(to, from) {
155
         $route(to, from) {
149
-            // Filter the path to remove blank strings and
150
-            // only grab the hero if moving to another list page
151
-            // eg. list page -> list page
152
-            // const path = to.fullPath.split('/').filter(p => p)
153
-            // console.log('to:', path)
154
-            // console.log('?:', path.pop())
155
-            // console.log('?:', path.pop())
156
-
157
-            // Always reset the page count
156
+            // Always reset the page count & fetch flag
157
+            console.log('route to:', to)
158
+            console.log('route from:', from)
158
             this.page = 0
159
             this.page = 0
159
-            
160
+            this.keepFetching = true
160
             this.setIntersectionLoader()
161
             this.setIntersectionLoader()
161
         },
162
         },
162
     },
163
     },
163
     created() {
164
     created() {
164
-        console.log('--- liiiist ---')
165
+        console.log('--- List page ---')
165
         this.setIntersectionLoader()
166
         this.setIntersectionLoader()
166
     },
167
     },
167
 }
168
 }

+ 1
- 1
vue-theme/src/utils/helpers.js Parādīt failu

50
 
50
 
51
             // Only take the first match
51
             // Only take the first match
52
         type = type[0]
52
         type = type[0]
53
-        // console.log(`type derived from route.path: ${type}`)
53
+        // console.log(`type derived from route.pajth: ${type}`)
54
     }
54
     }
55
     
55
     
56
     console.log('from route->',type)
56
     console.log('from route->',type)

Notiek ielāde…
Atcelt
Saglabāt