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

:recycle: checking for capped limit on list pages

tags/0.9.0
J преди 4 години
родител
ревизия
3583887a65
променени са 4 файла, в които са добавени 15 реда и са изтрити 7 реда
  1. 11
    3
      vue-theme/src/pages/list.vue
  2. 1
    1
      vue-theme/src/store/modules/event.js
  3. 1
    1
      vue-theme/src/store/modules/exhibition.js
  4. 2
    2
      vue-theme/src/store/modules/post.js

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

@@ -62,7 +62,11 @@ export default {
62 62
         },
63 63
     },
64 64
     methods: {
65
-        getPosts() {
65
+        getPosts(offset) {
66
+            // Limit
67
+            let params = {
68
+                limit: 20
69
+            }
66 70
             // Sorting
67 71
             let sort = this.sortBy
68 72
                 ? this.sortBy
@@ -79,18 +83,20 @@ export default {
79 83
 
80 84
             // Don't dispatch if there's no type
81 85
             if (this.type && this.dispatchName) {
82
-                this.$store.dispatch(this.dispatchName, sort)
86
+                this.$store.dispatch(this.dispatchName, sort, params)
83 87
 
84 88
                 if (this.type == 'event') {
85 89
                     this.$store.dispatch(
86 90
                         'getAllExhibitions',
87 91
                         sortTypes.currentAndUpcoming,
92
+                        params
88 93
                     )
89 94
                 }
90 95
                 if (this.type == 'exhibition') {
91 96
                     this.$store.dispatch(
92 97
                         'getAllEvents',
93 98
                         sortTypes.currentAndUpcoming,
99
+                        params
94 100
                     )
95 101
                 }
96 102
             }
@@ -158,7 +164,9 @@ export default {
158 164
         let type = convertTitleCase(this.type) + 's'
159 165
         this.checkAndSetHero(this.type)
160 166
 
161
-        if (!this[`all${type}Loaded`]) this.getPosts()
167
+        // We also need to check if only ONE has been loaded because
168
+        // coming from the homepage there will only be 1 item
169
+        if (!this[`all${type}Loaded`] || this[`all${type}`].length < 2) this.getPosts()
162 170
     },
163 171
 }
164 172
 </script>

+ 1
- 1
vue-theme/src/store/modules/event.js Целия файл

@@ -24,7 +24,7 @@ const getters = {
24 24
 }
25 25
 
26 26
 const actions = {
27
-    getAllEvents({ commit }, sortType) {
27
+    getAllEvents({ commit }, sortType, params) {
28 28
         commit('CLEAR_EVENTS')
29 29
         commit('EVENTS_LOADED', false)
30 30
         return api.getByType('event', sortType, events => {

+ 1
- 1
vue-theme/src/store/modules/exhibition.js Целия файл

@@ -26,7 +26,7 @@ const getters = {
26 26
 }
27 27
 
28 28
 const actions = {
29
-    getAllExhibitions({ commit }, sortType) {
29
+    getAllExhibitions({ commit }, sortType, params) j{
30 30
         commit('CLEAR_EXHIBITIONS')
31 31
         commit('EXHIBITIONS_LOADED', false)
32 32
         return api.getByType('exhibition', sortType, exhibitions => {

+ 2
- 2
vue-theme/src/store/modules/post.js Целия файл

@@ -12,13 +12,13 @@ const getters = {
12 12
 }
13 13
 
14 14
 const actions = {
15
-    getAllPosts({ commit }, sortType) {
15
+    getAllPosts({ commit }, sortType, params) {
16 16
         commit('CLEAR_POSTS')
17 17
         commit('POSTS_LOADED', false)
18 18
         return api.getByType('post', sortType, posts => {
19 19
             commit('STORE_FETCHED_POSTS', { posts })
20 20
             commit('POSTS_LOADED', true)
21
-        })
21
+        }, params)
22 22
     },
23 23
     getSinglePost({ commit }, id) {
24 24
         commit('CLEAR_SINGLE_POSTS')

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