Ver código fonte

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

tags/0.9.0
J 4 anos atrás
pai
commit
a7015352f4
2 arquivos alterados com 16 adições e 15 exclusões
  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 Ver arquivo

@@ -9,7 +9,10 @@
9 9
                     h3 sorted {{ sortBy.replace('-', ' ') }}
10 10
 
11 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 17
         .posts(v-if="posts && loaded" :class="{ 'is-grid': grid }")
15 18
             section(v-for="(post, i) in posts" :key="post.slug").shadow.post
@@ -97,8 +100,8 @@ export default {
97 100
         async getPosts({ clear }) {
98 101
             const dispatchAction = clear ? `getAll${this.pType}` : `getMore${this.pType}`
99 102
             // pType sometimes is undefined so need to dispatch and
100
-            // Episodes only needs load call
101 103
             let res = null
104
+            // Episodes only needs load call
102 105
             if(this.pType && dispatchAction != `getMoreEpisodes`) {
103 106
                 console.log('d:', dispatchAction, this._getDispatchParams())
104 107
                 res = await this.$store.dispatch(dispatchAction, this._getDispatchParams())
@@ -116,7 +119,10 @@ export default {
116 119
             this._clearHero(this.$store)
117 120
 
118 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 128
             // We always set a hero no matter what
@@ -133,6 +139,7 @@ export default {
133 139
         setIntersectionLoader() {
134 140
             console.warn('setting up intersection handler for:', this.type)
135 141
             window.removeEventListener("load", e => {}, false)
142
+            console.warn('all intersection handlers:', window)
136 143
             const footerEl = document.querySelector(".footer-wrapper footer")
137 144
             if(!footerEl) return
138 145
 
@@ -146,22 +153,16 @@ export default {
146 153
     },
147 154
     watch: {
148 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 159
             this.page = 0
159
-            
160
+            this.keepFetching = true
160 161
             this.setIntersectionLoader()
161 162
         },
162 163
     },
163 164
     created() {
164
-        console.log('--- liiiist ---')
165
+        console.log('--- List page ---')
165 166
         this.setIntersectionLoader()
166 167
     },
167 168
 }

+ 1
- 1
vue-theme/src/utils/helpers.js Ver arquivo

@@ -50,7 +50,7 @@ const typeFromRoute = route => {
50 50
 
51 51
             // Only take the first match
52 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 56
     console.log('from route->',type)

Carregando…
Cancelar
Salvar