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

: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
         },
62
         },
63
     },
63
     },
64
     methods: {
64
     methods: {
65
-        getPosts() {
65
+        getPosts(offset) {
66
+            // Limit
67
+            let params = {
68
+                limit: 20
69
+            }
66
             // Sorting
70
             // Sorting
67
             let sort = this.sortBy
71
             let sort = this.sortBy
68
                 ? this.sortBy
72
                 ? this.sortBy
79
 
83
 
80
             // Don't dispatch if there's no type
84
             // Don't dispatch if there's no type
81
             if (this.type && this.dispatchName) {
85
             if (this.type && this.dispatchName) {
82
-                this.$store.dispatch(this.dispatchName, sort)
86
+                this.$store.dispatch(this.dispatchName, sort, params)
83
 
87
 
84
                 if (this.type == 'event') {
88
                 if (this.type == 'event') {
85
                     this.$store.dispatch(
89
                     this.$store.dispatch(
86
                         'getAllExhibitions',
90
                         'getAllExhibitions',
87
                         sortTypes.currentAndUpcoming,
91
                         sortTypes.currentAndUpcoming,
92
+                        params
88
                     )
93
                     )
89
                 }
94
                 }
90
                 if (this.type == 'exhibition') {
95
                 if (this.type == 'exhibition') {
91
                     this.$store.dispatch(
96
                     this.$store.dispatch(
92
                         'getAllEvents',
97
                         'getAllEvents',
93
                         sortTypes.currentAndUpcoming,
98
                         sortTypes.currentAndUpcoming,
99
+                        params
94
                     )
100
                     )
95
                 }
101
                 }
96
             }
102
             }
158
         let type = convertTitleCase(this.type) + 's'
164
         let type = convertTitleCase(this.type) + 's'
159
         this.checkAndSetHero(this.type)
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
 </script>
172
 </script>

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

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

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

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

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

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

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