Bläddra i källkod

:recycle: fixing import | refactor flat packing titles

tags/0.9.0
J 4 år sedan
förälder
incheckning
802ed0857b
2 ändrade filer med 15 tillägg och 15 borttagningar
  1. 1
    0
      vue-theme/src/pages/list.vue
  2. 14
    15
      vue-theme/src/store/modules/arrangements.js

+ 1
- 0
vue-theme/src/pages/list.vue Visa fil

115
             try {
115
             try {
116
                 this.loadingFetched = true
116
                 this.loadingFetched = true
117
                 this.page++
117
                 this.page++
118
+                console.log('shouldLoadAll :', this.shouldLoadAllAtOnce, this.type)
118
                 const res = await getPosts(
119
                 const res = await getPosts(
119
                     {
120
                     {
120
                         limit: this.shouldLoadAllAtOnce ? -1 : this.perPage,
121
                         limit: this.shouldLoadAllAtOnce ? -1 : this.perPage,

+ 14
- 15
vue-theme/src/store/modules/arrangements.js Visa fil

1
+import { sortTypes } from '../../utils/helpers'
2
+
3
+const _makeFlatpack = bySort => {
4
+    const flatPacked = []
5
+    Object.keys(bySort).forEach(sort => {
6
+        flatPacked.push({ slug: sort, title: sort, inbetween: true })
7
+        bySort[sort].forEach(post => flatPacked.push(post))
8
+    })
9
+    return flatPacked
10
+}
11
+
1
 const _arrangeByMaterial = postsList => {
12
 const _arrangeByMaterial = postsList => {
2
     const byMaterial = {
13
     const byMaterial = {
3
         clay: []
14
         clay: []
8
             byMaterial[mat].push(post)
19
             byMaterial[mat].push(post)
9
         })
20
         })
10
     })
21
     })
11
-    const flatPacked = []
12
-    Object.keys(byMaterial).forEach(material => {
13
-        flatPacked.push({ slug: material, title: material, inbetween: true })
14
-        byMaterial[material].forEach(post => flatPacked.push(post))
15
-    })
22
+    const flatPacked = _makeFlatpack(byMaterial)
16
     return flatPacked
23
     return flatPacked
17
 }
24
 }
18
 
25
 
25
             byType[type].push(post)
32
             byType[type].push(post)
26
         })
33
         })
27
     })
34
     })
28
-    const flatPacked = []
29
-    Object.keys(byType).forEach(type => {
30
-        flatPacked.push({ slug: type, title: type, inbetween: true })
31
-        byType[type].forEach(post => flatPacked.push(post))
32
-    })
35
+    const flatPacked = _makeFlatpack(byType)
33
     return flatPacked
36
     return flatPacked
34
 }
37
 }
35
 
38
 
62
         if(!byEpisode[relatedEpisode]) byEpisode[relatedEpisode] = []
65
         if(!byEpisode[relatedEpisode]) byEpisode[relatedEpisode] = []
63
         byEpisode[relatedEpisode].push(post)
66
         byEpisode[relatedEpisode].push(post)
64
     })
67
     })
65
-    const flatPacked = []
66
-    Object.keys(byEpisode).forEach(episode => {
67
-        flatPacked.push({ slug: episode, title: episode, inbetween: true })
68
-        byEpisode[episode].forEach(post => flatPacked.push(post))
69
-    })
68
+    const flatPacked = _makeFlatpack(byEpisode)
70
     return flatPacked
69
     return flatPacked
71
 }
70
 }
72
 
71
 

Laddar…
Avbryt
Spara