Преглед на файлове

:recycle: simplifying flow control for getMore

tags/0.9.0
J преди 4 години
родител
ревизия
7d1835af67
променени са 1 файла, в които са добавени 4 реда и са изтрити 6 реда
  1. 4
    6
      vue-theme/src/pages/list.vue

+ 4
- 6
vue-theme/src/pages/list.vue Целия файл

88
             let dispatchParams = { sortType: sort, params }
88
             let dispatchParams = { sortType: sort, params }
89
             let dispatchAction = `getAll${this.pType}`
89
             let dispatchAction = `getAll${this.pType}`
90
 
90
 
91
-            if(dispatchAction && clear) {
92
-                if (this.type && ['event', 'exhibition'].includes(this.type)) {
93
-                    dispatchParams.sortType = sortTypes.currentAndUpcoming
94
-                }
91
+            if(clear && this.type && ['event', 'exhibition'].includes(this.type)) {
92
+                dispatchParams.sortType = sortTypes.currentAndUpcoming
95
             }
93
             }
96
             // Add to existing except episodes
94
             // Add to existing except episodes
97
-            else if (!clear && this.type != 'episode') {
95
+            else {
98
                 dispatchAction = `getMore${this.pType}`
96
                 dispatchAction = `getMore${this.pType}`
99
             }
97
             }
100
             const res = await this.$store.dispatch(dispatchAction, dispatchParams)
98
             const res = await this.$store.dispatch(dispatchAction, dispatchParams)
101
             
99
             
102
             console.log('responded:', res)
100
             console.log('responded:', res)
103
-            if(!res) {
101
+            if(!res.length) {
104
                 console.warn('nothing left to get...')
102
                 console.warn('nothing left to get...')
105
             }
103
             }
106
         },
104
         },

Loading…
Отказ
Запис