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

:recycle: simplifying flow control for getMore

tags/0.9.0
J 4 лет назад
Родитель
Сommit
7d1835af67
1 измененных файлов: 4 добавлений и 6 удалений
  1. 4
    6
      vue-theme/src/pages/list.vue

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

@@ -88,19 +88,17 @@ export default {
88 88
             let dispatchParams = { sortType: sort, params }
89 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 94
             // Add to existing except episodes
97
-            else if (!clear && this.type != 'episode') {
95
+            else {
98 96
                 dispatchAction = `getMore${this.pType}`
99 97
             }
100 98
             const res = await this.$store.dispatch(dispatchAction, dispatchParams)
101 99
             
102 100
             console.log('responded:', res)
103
-            if(!res) {
101
+            if(!res.length) {
104 102
                 console.warn('nothing left to get...')
105 103
             }
106 104
         },

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