Przeglądaj źródła

:recycle: override dispatch params for material sort

tags/0.9.0
J 4 lat temu
rodzic
commit
99603ee4d6
1 zmienionych plików z 9 dodań i 8 usunięć
  1. 9
    8
      vue-theme/src/pages/list.vue

+ 9
- 8
vue-theme/src/pages/list.vue Wyświetl plik

@@ -103,11 +103,11 @@ export default {
103 103
                       .filter(p => p)
104 104
                       .pop()
105 105
         },
106
-        _getDispatchParams() {
106
+        _getDispatchParams(perPage) {
107 107
             return {
108 108
                 sortType: this._getSortBy(),
109 109
                 params: {
110
-                    limit: this.perPage,
110
+                    limit: perPage ? perPage : this.perPage,
111 111
                     page: this.page
112 112
                 }
113 113
             }
@@ -118,16 +118,16 @@ export default {
118 118
             const ignore = [`getMoreEpisodes`, 'getMorePages']
119 119
 
120 120
             let dispatchAction = `getMore${this.pType}`
121
+            let params = this._getDispatchParams()
122
+
121 123
             if(this._getSortBy() == sortTypes.material && this.type == 'artist') {
122 124
                 dispatchAction = `getAll${this.pType}`
125
+                params = this._getDispatchParams(-1)
123 126
             }
124
-            
127
+
125 128
             let res = null
126 129
             if(this.pType && !ignore.includes(dispatchAction)) {
127
-                res = await this.$store.dispatch(
128
-                    dispatchAction,
129
-                    this._getDispatchParams()
130
-                )
130
+                res = await this.$store.dispatch(dispatchAction, params)
131 131
             }
132 132
 
133 133
             // Stop trying to load more posts
@@ -156,7 +156,8 @@ export default {
156 156
             this.$store.commit('SET_HERO', this._setHeroInfo(page))
157 157
         },
158 158
         setIntersectionLoader() {
159
-            if(!this.type) return console.error('cannot setup interseciton handler for undefined type')
159
+            if(!this.type) return console.error('cannot setup intersection handler for undefined type')
160
+            if(this._getSortBy() == sortTypes.material && this.type == 'artist') return console.error('cannot setup intersection handler for material sort')
160 161
 
161 162
             const footerEl = document.querySelector(INTERSECT_SELECTOR)
162 163
             if(!footerEl) return

Ładowanie…
Anuluj
Zapisz