Sfoglia il codice sorgente

:sparkles: adding lightbox

tags/1.0.1^2^2
J 3 anni fa
parent
commit
2ca2e6043b

+ 224
- 11093
vue-theme/package-lock.json
File diff soppresso perché troppo grande
Vedi File


+ 2
- 1
vue-theme/package.json Vedi File

19
     "@babel/plugin-syntax-dynamic-import": "^7.8.3",
19
     "@babel/plugin-syntax-dynamic-import": "^7.8.3",
20
     "@babel/preset-env": "^7.12.11",
20
     "@babel/preset-env": "^7.12.11",
21
     "@vue/compiler-sfc": "^3.0.5",
21
     "@vue/compiler-sfc": "^3.0.5",
22
-    "axios": "^0.21.1",
22
+    "axios": "^0.21.4",
23
     "babel-loader": "^8.2.2",
23
     "babel-loader": "^8.2.2",
24
     "css-loader": "^3.6.0",
24
     "css-loader": "^3.6.0",
25
     "file-loader": "^6.2.0",
25
     "file-loader": "^6.2.0",
43
     "chokidar": "^3.5.1",
43
     "chokidar": "^3.5.1",
44
     "compression-webpack-plugin": "^3.1.0",
44
     "compression-webpack-plugin": "^3.1.0",
45
     "vue": "^3.0.5",
45
     "vue": "^3.0.5",
46
+    "vue-easy-lightbox": "^1.8.2",
46
     "vue-router": "^4.0.2",
47
     "vue-router": "^4.0.2",
47
     "vuex": "^4.0.0-rc.2"
48
     "vuex": "^4.0.0-rc.2"
48
   },
49
   },

+ 4
- 1
vue-theme/src/index.js Vedi File

2
 import router from '@/router'
2
 import router from '@/router'
3
 import store from '@/store'
3
 import store from '@/store'
4
 
4
 
5
+// in this path vue-easy-lightbox/dist/external-css/*.js
6
+import VueEasyLightbox from 'vue-easy-lightbox/dist/external-css/vue-easy-lightbox.esm.min.js'
7
+
5
 import App from '@/app.vue'
8
 import App from '@/app.vue'
6
 
9
 
7
 const craft = createApp(App)
10
 const craft = createApp(App)
8
 
11
 
9
-craft.use(router).use(store).mount('#wp-app')
12
+craft.use(router).use(store).use(VueEasyLightbox).mount('#wp-app')

+ 81
- 87
vue-theme/src/pages/single.vue Vedi File

1
 <template lang="pug">
1
 <template lang="pug">
2
 .page--single.f-col.between
2
 .page--single.f-col.between
3
-    gallery(v-if="activeGalleryIndex >= 0" :activeImageIndex="activeImageIndex" :images="imagesInGallery" @close="closeGallery")
4
-
5
     article.w-max.f-grow.shadow(v-if="!singlePost || loading")
3
     article.w-max.f-grow.shadow(v-if="!singlePost || loading")
6
         header
4
         header
7
             p loading...
5
             p loading...
9
         header
7
         header
10
             //- breadcrumb links at top of page, needs link routing
8
             //- breadcrumb links at top of page, needs link routing
11
             breadcrumb(:type="type" :post="singlePost")
9
             breadcrumb(:type="type" :post="singlePost")
12
-            
13
-            h1.t-b {{ singlePost.title }}
14
-            //- p(v-if="singlePost.categories") categories: {{ singlePost.categories }}
15
-            //- p(v-if="singlePost.type") type: {{ singlePost.type }}
16
-            //- p(v-if="singlePost.subtypes") subtypes: {{ singlePost.subtypes }}
17
 
10
 
11
+            h1.t-b {{ singlePost.title }}
18
             .date-info.t-cntr(v-if="['exhibition', 'event'].includes(type)")
12
             .date-info.t-cntr(v-if="['exhibition', 'event'].includes(type)")
19
                 //- for events display: date, time-time
13
                 //- for events display: date, time-time
20
                 h4(v-if="singlePost.start, singlePost.end && type == 'event'") {{ dateFrom(singlePost.start, type == 'event') }} - {{ dateFrom(singlePost.end, type == 'event').split(',')[1] }}
14
                 h4(v-if="singlePost.start, singlePost.end && type == 'event'") {{ dateFrom(singlePost.start, type == 'event') }} - {{ dateFrom(singlePost.end, type == 'event').split(',')[1] }}
21
                 //- else for single, exhibition: date-date
15
                 //- else for single, exhibition: date-date
22
                 h4(v-else-if="singlePost.start, singlePost.end") {{ dateFrom(singlePost.start, type == 'event') }} - {{ dateFrom(singlePost.end, type == 'event') }}
16
                 h4(v-else-if="singlePost.start, singlePost.end") {{ dateFrom(singlePost.start, type == 'event') }} - {{ dateFrom(singlePost.end, type == 'event') }}
17
+        
23
         //- WP main content
18
         //- WP main content
24
         section.content(v-html="singlePost.content")
19
         section.content(v-html="singlePost.content")
25
 
20
 
26
         //- related artists section for episodes
21
         //- related artists section for episodes
27
-        section(v-if="type === 'episode' && post").related-artists
28
-            h2.t-up featured in this episode
29
-            ul
30
-                li.f-row.between(v-for="artist in p2pPostsByType['artist']")
31
-                    card(:content="artist" type="artist" :wide="true" :hide-type="true")
22
+        template(v-if="type === 'episode' && post")
23
+            section.related-artists
24
+                h2.t-up featured in this episode
25
+                ul
26
+                    li.f-row.between(v-for="artist in p2pPostsByType['artist']")
27
+                        card(:content="artist" type="artist" :wide="true" :hide-type="true")
32
 
28
 
33
-        credits(v-if="type === 'episode' && singlePost" :post="singlePost")
29
+            credits(:post="singlePost")
34
 
30
 
35
         //- end of article icon
31
         //- end of article icon
36
         footer.f-col
32
         footer.f-col
37
             img(src="../star.svg")
33
             img(src="../star.svg")
38
 
34
 
35
+        vue-easy-lightbox(
36
+            :visible="activeGalleryIndex >= 0"
37
+            :imgs="activeGalleryImages"
38
+            :index="activeImageIndex"
39
+            @hide="activeGalleryIndex = -1"
40
+        )
41
+
39
     sidebar(:type="`${type}`" layout="single" :related="p2pPostsByType")
42
     sidebar(:type="`${type}`" layout="single" :related="p2pPostsByType")
40
 </template>
43
 </template>
41
 
44
 
49
 import { postTypeGetters, scrollTop, heroUtils } from './mixin-post-types'
52
 import { postTypeGetters, scrollTop, heroUtils } from './mixin-post-types'
50
 
53
 
51
 import { postTypes, convertTitleCase, formatDate } from '@/utils/helpers'
54
 import { postTypes, convertTitleCase, formatDate } from '@/utils/helpers'
52
-
53
-const TIMEOUT = 1
55
+import { nextTick } from '@vue/runtime-core'
54
 
56
 
55
 export default {
57
 export default {
56
     components: { sidebar, gallery, credits, card, breadcrumb },
58
     components: { sidebar, gallery, credits, card, breadcrumb },
57
     mixins: [postTypeGetters, scrollTop, heroUtils],
59
     mixins: [postTypeGetters, scrollTop, heroUtils],
58
     data() {
60
     data() {
59
         return {
61
         return {
60
-            // Gallery control
61
             activeGalleryIndex: -1,
62
             activeGalleryIndex: -1,
62
-            activeImageID: -1,
63
-            loading: true
63
+            activeImageIndex: 0,
64
+            loading: true,
64
         }
65
         }
65
     },
66
     },
66
     computed: {
67
     computed: {
67
         type() {
68
         type() {
68
-            return postTypes.includes(this.$route.params.type) ? this.$route.params.type : 'post'
69
+            return postTypes.includes(this.$route.params.type)
70
+                ? this.$route.params.type
71
+                : 'post'
69
         },
72
         },
70
         slug() {
73
         slug() {
71
             return this.$route.params.slug
74
             return this.$route.params.slug
75
          * Careful with name collisions with vuex helpers
78
          * Careful with name collisions with vuex helpers
76
          */
79
          */
77
         singlePost() {
80
         singlePost() {
78
-            const postType = this.type == 'blog' ? 'post': this.type
81
+            const postType = this.type == 'blog' ? 'post' : this.type
79
             if (!this[postType]) return
82
             if (!this[postType]) return
80
 
83
 
81
             // State not a getter!
84
             // State not a getter!
82
             const singleOfTypeFromState =
85
             const singleOfTypeFromState =
83
                 this[postType][`single${convertTitleCase(postType)}`]
86
                 this[postType][`single${convertTitleCase(postType)}`]
84
 
87
 
85
-            if (!singleOfTypeFromState) return
86
-
87
-            return singleOfTypeFromState
88
+            return singleOfTypeFromState ? singleOfTypeFromState : {}
88
         },
89
         },
89
-
90
-        idsForGallery() {
91
-            if (!this.singlePost || this.activeGalleryIndex < 0) return []
92
-            return this.singlePost.galleries[this.activeGalleryIndex].ids
93
-        },
94
-        /**
95
-         * We need a convenient way to get all the images
96
-         * broken down by gallery. We use the active gallery
97
-         * image IDs to create a map. We match the ID to the
98
-         * image size and url information returned by singlePost.attached
99
-         */
100
-        imagesInGallery() {
101
-            if (!this.activeGalleryIndex < 0) return {}
102
-
103
-            return this.idsForGallery.reduce((imageMap, id) => {
104
-                imageMap[id] = this.singlePost.attached[parseInt(id)]
105
-                return imageMap
106
-            }, {})
90
+        singlePostGalleries() {
91
+            if (!this.singlePost.galleries) return
92
+            const galleries = []
93
+            this.singlePost.galleries.forEach(gallery => {
94
+                const withImages = {}
95
+                gallery.ids.forEach(imageId => {
96
+                    withImages[imageId] = this.singlePost.attached[imageId]
97
+                })
98
+                galleries.push(withImages)
99
+            })
100
+            return galleries
107
         },
101
         },
108
-        activeImageIndex() {
109
-            return Object.keys(this.imagesInGallery).indexOf(
110
-                this.activeImageID.toString(),
102
+        activeGalleryImages() {
103
+            if (!this.singlePostGalleries || this.activeGalleryIndex < 0)
104
+                return []
105
+            return Object.values(
106
+                this.singlePostGalleries[this.activeGalleryIndex],
111
             )
107
             )
112
         },
108
         },
113
         p2pPostsByType() {
109
         p2pPostsByType() {
125
         },
121
         },
126
     },
122
     },
127
     methods: {
123
     methods: {
128
-        /**
129
-         * We set the active gallery to the index.
130
-         * Everything kicks off when activeGallery
131
-         * is set. We also need to set the activeImageID
132
-         * to the image clicked
133
-         * @param {string} imageInfo
134
-         */
135
-        openGallery(imageInfo) {
136
-            const byIndex = this.singlePost.galleries.reduce(
137
-                (byIndex, gallery, index) => {
138
-                    byIndex[index] = gallery.ids
139
-                    return byIndex
140
-                },
141
-                {},
142
-            )
143
-            let matchingIndex = 0
144
-            Object.keys(byIndex).forEach(galleryIndex => {
145
-                if (
146
-                    byIndex[galleryIndex].includes(
147
-                        parseInt(imageInfo.dataset.id)
148
-                    )
149
-                )
150
-                    matchingIndex = galleryIndex
151
-            })
152
-            this.activeGalleryIndex = matchingIndex
153
-            this.activeImageID = imageInfo.dataset.id
154
-                ? parseInt(imageInfo.dataset.id)
155
-                : parseInt(imageInfo.className.split('-').pop())
156
-        },
157
-        closeGallery() {
158
-            this.activeGalleryIndex = this.activeImageID = -1
159
-        },
160
         // _setHeroInfo(post) {} from mixin
124
         // _setHeroInfo(post) {} from mixin
161
         // _clearHero(store) {} from mixin
125
         // _clearHero(store) {} from mixin
162
         /**
126
         /**
183
              * which is derived from the route
147
              * which is derived from the route
184
              */
148
              */
185
             // modules are NOT plural because module key
149
             // modules are NOT plural because module key
186
-            const postType = this.type == 'blog' ? 'post': this.type
150
+            const postType = this.type == 'blog' ? 'post' : this.type
187
             if (!this.$store.state[postType]) return
151
             if (!this.$store.state[postType]) return
188
             const allPostsOfTypeInStore = this.$store.state[postType].all
152
             const allPostsOfTypeInStore = this.$store.state[postType].all
189
 
153
 
198
 
162
 
199
             // Look if it exists before you try and load everything!
163
             // Look if it exists before you try and load everything!
200
             if (!singlePostData) {
164
             if (!singlePostData) {
201
-                console.warn('Could not find single post in store; Fetching everything...')
165
+                console.warn(
166
+                    'Could not find single post in store; Fetching everything...',
167
+                )
202
                 const res = await this.$store.dispatch(
168
                 const res = await this.$store.dispatch(
203
                     `getAll${convertTitleCase(postType)}s`,
169
                     `getAll${convertTitleCase(postType)}s`,
204
-                    { sortType: null, params: null }
170
+                    { sortType: null, params: null },
205
                 )
171
                 )
206
-                singlePostData = res.filter(
207
-                    post => post.slug == this.slug,
208
-                )[0]
172
+                singlePostData = res.filter(post => post.slug == this.slug)[0]
209
             }
173
             }
210
 
174
 
211
             /**
175
             /**
213
              */
177
              */
214
             try {
178
             try {
215
                 this.checkAndSetHero(singlePostData)
179
                 this.checkAndSetHero(singlePostData)
216
-                await this.$store.dispatch(
180
+                this.$store.dispatch(
217
                     `getSingle${convertTitleCase(postType)}`,
181
                     `getSingle${convertTitleCase(postType)}`,
218
                     singlePostData.id,
182
                     singlePostData.id,
219
                 )
183
                 )
227
         slug(newSlug, oldSlug) {
191
         slug(newSlug, oldSlug) {
228
             // ONLY load post data when navigating TO a single page
192
             // ONLY load post data when navigating TO a single page
229
             // OR when navigating TO a single page from a single page
193
             // OR when navigating TO a single page from a single page
230
-            if(newSlug && !oldSlug || newSlug && oldSlug) {
194
+            if ((newSlug && !oldSlug) || (newSlug && oldSlug)) {
231
                 this._clearHero(this.$store)
195
                 this._clearHero(this.$store)
232
                 this.loadPostData()
196
                 this.loadPostData()
233
             }
197
             }
234
         },
198
         },
199
+        async singlePost(post) {
200
+            console.log('---')
201
+            const content = this.$el.children[0].querySelector('section')
202
+            await nextTick()
203
+            const galleries = content.querySelectorAll('.wp-block-gallery')
204
+            const cb = e => {
205
+                this.activeGalleryIndex = parseInt(e.target.dataset.gallery)
206
+                const galleryImages = Object.keys(
207
+                    this.singlePostGalleries[this.activeGalleryIndex],
208
+                )
209
+                this.activeImageIndex = parseInt(
210
+                    galleryImages.indexOf(e.target.dataset.id),
211
+                )
212
+                console.log(
213
+                    `opening gallery: ${this.activeGalleryIndex}.${this.activeImageIndex}`,
214
+                )
215
+                console.log(e.target.dataset)
216
+            }
217
+            galleries.forEach((gal, galleryIndex) => {
218
+                gal.querySelectorAll('img').forEach(image => {
219
+                    image.dataset.gallery = galleryIndex
220
+                    if (image.addEventListener) {
221
+                        image.addEventListener('click', cb, false)
222
+                    } else {
223
+                        image.attachEvent('onclick', cb)
224
+                    }
225
+                })
226
+            })
227
+        },
235
     },
228
     },
236
     created() {
229
     created() {
237
-       this.loadPostData()
230
+        this.loadPostData()
238
     },
231
     },
232
+    beforeDestroy() {},
239
 }
233
 }
240
 </script>
234
 </script>
241
 
235
 
243
 // prettier-ignore
237
 // prettier-ignore
244
 @import '../sss/variables.sss'
238
 @import '../sss/variables.sss'
245
 @import '../sss/theme.sss'
239
 @import '../sss/theme.sss'
240
+
246
 .page--single
241
 .page--single
247
     article
242
     article
248
         background-color: white
243
         background-color: white
331
         &.f-col
326
         &.f-col
332
             flex-direction: row
327
             flex-direction: row
333
             .wp-block-embed, .is-type-video
328
             .wp-block-embed, .is-type-video
334
-                margin-bottom: $ms-9 
335
-
329
+                margin-bottom: $ms-9
336
 </style>
330
 </style>

+ 190
- 0
vue-theme/src/sss/_lightbox.sss Vedi File

1
+.vel-fade
2
+    &-enter-active, &-active
3
+        transition: all 0.3s ease
4
+    &-enter-from, &-leave-to
5
+        opacity: 0
6
+
7
+.vel-img
8
+    &-swiper
9
+        display: block
10
+        position: relative
11
+    &-wrapper
12
+        left: 50%
13
+        margin: 0
14
+        position: absolute
15
+        top: 50%
16
+        transform: translate(-50% -50%)
17
+        transition: 0.3s linear
18
+        will-change: transform opacity
19
+    background-color: rgba(0, 0, 0, 0.7)
20
+    box-shadow: 0 5px 20px 2px rgba(0, 0, 0, 0.7)
21
+    display: block
22
+    max-height: 80vh
23
+    max-width: 80vw
24
+    position: relative
25
+    transition: transform 0.3s ease-in-out
26
+
27
+.vel-modal
28
+    background: rgba(0, 0, 0, 0.5)
29
+    bottom: 0
30
+    left: 0
31
+    margin: 0
32
+    position: fixed
33
+    right: 0
34
+    top: 0
35
+    z-index: 10003
36
+
37
+.vel-img, .vel-img-wrapper
38
+    user-select: none
39
+
40
+.vel-btns-wrapper
41
+    .btn__close, .btn__next, .btn__prev
42
+        color: #fff
43
+        cursor: pointer
44
+        font-size: 32px
45
+        opacity: 0.6
46
+        outline: none
47
+        position: absolute
48
+        top: 50%
49
+        transform: translateY(-50%)
50
+        transition: 0.15s linear
51
+        user-select: none
52
+        &:hover
53
+            opacity: 1
54
+        &.disable, &.disable:hover
55
+            cursor: default
56
+            opacity: 0.2
57
+    .btn__next
58
+        right: 12px
59
+    .btn__prev
60
+        left: 12px
61
+    .btn__close
62
+        right: 10px
63
+        top: 24px
64
+
65
+@media (max-width: 750px)
66
+    .vel-img
67
+        max-height: 95vh
68
+        max-width: 85vw
69
+    .vel-btns-wrapper
70
+        .btn__next, .btn__prev
71
+            font-size: 20px
72
+        .btn__close
73
+            font-size: 24px
74
+        .btn__next
75
+            right: 4px
76
+        .btn__prev
77
+            left: 4px
78
+    .vel-modal.is-rtl .vel-btns-wrapper
79
+        .btn__next
80
+            left: 4px
81
+            right: auto
82
+        .btn__prev
83
+            left: auto
84
+            right: 4px
85
+
86
+.vel-modal.is-rtl
87
+    .vel-btns-wrapper
88
+        .btn__next
89
+            left: 12px
90
+            right: auto
91
+        .btn__prev
92
+            left: auto
93
+            right: 12px
94
+
95
+.vel-modal.is-rtl .vel-img-title
96
+    direction: rtl
97
+
98
+.vel-loading
99
+    left: 50%
100
+    position: absolute
101
+    top: 50%
102
+    -webkit-transform: translate(-50%, -50%)
103
+    transform: translate(-50%, -50%)
104
+    .ring
105
+        display: inline-block
106
+        height: 64px
107
+        width: 64px
108
+        &:after
109
+            animation: ring 1.2s linear infinite
110
+            border-color: hsla(0, 0%, 100%, 0.7) transparent
111
+            border-radius: 50%
112
+            border-style: solid
113
+            border-width: 5px
114
+            content: ' '
115
+            display: block
116
+            height: 46px
117
+            margin: 1px
118
+            width: 46px
119
+
120
+@-webkit-keyframes ring
121
+    0%
122
+        transform: rotate(0deg)
123
+    to
124
+        transform: rotate(1turn)
125
+
126
+@keyframes ring
127
+    0%
128
+        transform: rotate(0deg)
129
+    to
130
+        transform: rotate(1turn)
131
+    
132
+
133
+.vel-on-error
134
+    left: 50%
135
+    position: absolute
136
+    top: 50%
137
+    transform: translate(-50%, -50%)
138
+    .icon
139
+        color: #aaa
140
+        font-size: 80px
141
+
142
+.vel-img-title
143
+    bottom: 60px
144
+    color: #ccc
145
+    cursor: default
146
+    font-size: 12px
147
+    left: 50%
148
+    line-height: 1
149
+    max-width: 80%
150
+    opacity: 0.8
151
+    overflow: hidden
152
+    position: absolute
153
+    text-align: center
154
+    text-overflow: ellipsis
155
+    transform: translate(-50%)
156
+    transition: opacity 0.15s
157
+    white-space: nowrap
158
+    &:hover
159
+        opacity: 1
160
+
161
+.vel-icon
162
+    fill: currentColor
163
+    height: 1em
164
+    overflow: hidden
165
+    vertical-align: -0.15em
166
+    width: 1em
167
+
168
+.vel-toolbar
169
+    border-radius: 4px
170
+    bottom: 8px
171
+    display: flex
172
+    left: 50%
173
+    opacity: 0.9
174
+    overflow: hidden
175
+    padding: 0
176
+    position: absolute
177
+    transform: translate(-50%)
178
+    .toolbar-btn
179
+        color: #fff
180
+        cursor: pointer
181
+        flex-shrink: 0
182
+        font-size: 20px
183
+        outline: none
184
+        padding: 6px 10px
185
+        &:active, &:hover
186
+            background-color: #3d3d3d
187
+
188
+.vel-toolbar, .vel-toolbar .toolbar-btn
189
+    background-color: #2d2d2d
190
+    user-select: none

+ 7
- 6
vue-theme/src/sss/index.js Vedi File

1
 // Include all your *.sss Sugarss files
1
 // Include all your *.sss Sugarss files
2
-import "./_reset.sss";
3
-import "./_ratios.sss";
4
-import "./_helpers.sss";
5
-import "./_typography.sss";
2
+import './_reset.sss'
3
+import './_ratios.sss'
4
+import './_helpers.sss'
5
+import './_typography.sss'
6
+import './_lightbox.sss'
6
 
7
 
7
-import "./theme.sss";
8
-import "./variables.sss";
8
+import './theme.sss'
9
+import './variables.sss'

+ 17
- 7
vue-theme/src/store/modules/artist.js Vedi File

6
     all: [],
6
     all: [],
7
     loaded: false,
7
     loaded: false,
8
     singleArtist: null,
8
     singleArtist: null,
9
-    seenTitles: []
9
+    seenTitles: [],
10
 }
10
 }
11
 
11
 
12
 const getters = {
12
 const getters = {
19
     getAllArtists({ commit }, { sortType, params }) {
19
     getAllArtists({ commit }, { sortType, params }) {
20
         commit('CLEAR_ARTISTS')
20
         commit('CLEAR_ARTISTS')
21
         commit('ARTISTS_LOADED', false)
21
         commit('ARTISTS_LOADED', false)
22
-        const storeFetch = (artists => {
22
+        const storeFetch = artists => {
23
             let repacked = repackBySort(artists, sortType)
23
             let repacked = repackBySort(artists, sortType)
24
             commit('STORE_FETCHED_ARTISTS', { artists: repacked })
24
             commit('STORE_FETCHED_ARTISTS', { artists: repacked })
25
             commit('ARTISTS_LOADED', true)
25
             commit('ARTISTS_LOADED', true)
26
+        }
27
+        return api.getByType({
28
+            type: 'artist',
29
+            sort: sortType,
30
+            params,
31
+            cb: storeFetch,
26
         })
32
         })
27
-        return api.getByType({ type: 'artist', sort: sortType, params, cb: storeFetch })
28
     },
33
     },
29
     getMoreArtists({ commit }, { sortType, params }) {
34
     getMoreArtists({ commit }, { sortType, params }) {
30
-        const storeFetch = (artists => {
35
+        const storeFetch = artists => {
31
             let repacked = artists
36
             let repacked = artists
32
-            if(sortType == sortTypes.alpha) {
37
+            if (sortType == sortTypes.alpha) {
33
                 repacked = repackBySort(artists, sortType, state.seenTitles)
38
                 repacked = repackBySort(artists, sortType, state.seenTitles)
34
             }
39
             }
35
             commit('ADD_TO_FETCHED_ARTISTS', { artists: repacked })
40
             commit('ADD_TO_FETCHED_ARTISTS', { artists: repacked })
36
             commit('ARTISTS_LOADED', true)
41
             commit('ARTISTS_LOADED', true)
42
+        }
43
+        return api.getByType({
44
+            type: 'artist',
45
+            sort: sortType,
46
+            params,
47
+            cb: storeFetch,
37
         })
48
         })
38
-        return api.getByType({ type: 'artist', sort: sortType, params, cb: storeFetch })
39
     },
49
     },
40
     getSingleArtist({ commit }, id) {
50
     getSingleArtist({ commit }, id) {
41
         commit('CLEAR_SINGLE_ARTISTS')
51
         commit('CLEAR_SINGLE_ARTISTS')
42
         commit('ARTISTS_LOADED', false)
52
         commit('ARTISTS_LOADED', false)
43
 
53
 
44
-        api.getSingleType('artist', id, artist => {
54
+        return api.getSingleType('artist', id, artist => {
45
             commit('STORE_FETCHED_SINGLE_ARTIST', artist)
55
             commit('STORE_FETCHED_SINGLE_ARTIST', artist)
46
             commit('ARTISTS_LOADED', true)
56
             commit('ARTISTS_LOADED', true)
47
         })
57
         })

+ 17
- 6
vue-theme/src/store/modules/event.js Vedi File

12
     allEvents: state => state.all,
12
     allEvents: state => state.all,
13
     allEventsLoaded: state => state.loaded,
13
     allEventsLoaded: state => state.loaded,
14
     pastEvents: state => state.all.filter(event => parseInt(event.end) > now),
14
     pastEvents: state => state.all.filter(event => parseInt(event.end) > now),
15
-    upcomingAndCurrentEvents: state => state.all.filter(event => parseInt(event.end) <= now),
15
+    upcomingAndCurrentEvents: state =>
16
+        state.all.filter(event => parseInt(event.end) <= now),
16
 }
17
 }
17
 
18
 
18
 const actions = {
19
 const actions = {
19
     getAllEvents({ commit }, { sortType, params }) {
20
     getAllEvents({ commit }, { sortType, params }) {
20
         commit('CLEAR_EVENTS')
21
         commit('CLEAR_EVENTS')
21
         commit('EVENTS_LOADED', false)
22
         commit('EVENTS_LOADED', false)
22
-        const storeFetch = (events => {
23
+        const storeFetch = events => {
23
             commit('STORE_FETCHED_EVENTS', { events })
24
             commit('STORE_FETCHED_EVENTS', { events })
24
             commit('EVENTS_LOADED', true)
25
             commit('EVENTS_LOADED', true)
26
+        }
27
+        return api.getByType({
28
+            type: 'event',
29
+            sort: sortType,
30
+            params,
31
+            cb: storeFetch,
25
         })
32
         })
26
-        return api.getByType({ type: 'event', sort: sortType, params, cb: storeFetch })
27
     },
33
     },
28
     getMoreEvents({ commit }, { sortType, params }) {
34
     getMoreEvents({ commit }, { sortType, params }) {
29
-        const storeFetch = (events => {
35
+        const storeFetch = events => {
30
             commit('ADD_TO_FETCHED_EVENTS', { events })
36
             commit('ADD_TO_FETCHED_EVENTS', { events })
31
             commit('EVENTS_LOADED', true)
37
             commit('EVENTS_LOADED', true)
38
+        }
39
+        return api.getByType({
40
+            type: 'event',
41
+            sort: sortType,
42
+            params,
43
+            cb: storeFetch,
32
         })
44
         })
33
-        return api.getByType({ type: 'event', sort: sortType, params, cb: storeFetch })
34
     },
45
     },
35
     getSingleEvent({ commit }, id) {
46
     getSingleEvent({ commit }, id) {
36
         commit('CLEAR_SINGLE_EVENTS')
47
         commit('CLEAR_SINGLE_EVENTS')
37
         commit('EVENTS_LOADED', false)
48
         commit('EVENTS_LOADED', false)
38
-        api.getSingleType('event', id, event => {
49
+        return api.getSingleType('event', id, event => {
39
             commit('STORE_FETCHED_SINGLE_EVENT', event)
50
             commit('STORE_FETCHED_SINGLE_EVENT', event)
40
             commit('EVENTS_LOADED', true)
51
             commit('EVENTS_LOADED', true)
41
         })
52
         })

+ 20
- 8
vue-theme/src/store/modules/exhibition.js Vedi File

11
 const getters = {
11
 const getters = {
12
     allExhibitions: state => state.all,
12
     allExhibitions: state => state.all,
13
     allExhibitionsLoaded: state => state.loaded,
13
     allExhibitionsLoaded: state => state.loaded,
14
-    pastExhibitions: state => state.all.filter(exhibition => parseInt(exhibition.end) > now),
15
-    upcomingAndCurrentExhibitions: state => state.all.filter(exhibition => parseInt(exhibition.end) <= now)
14
+    pastExhibitions: state =>
15
+        state.all.filter(exhibition => parseInt(exhibition.end) > now),
16
+    upcomingAndCurrentExhibitions: state =>
17
+        state.all.filter(exhibition => parseInt(exhibition.end) <= now),
16
 }
18
 }
17
 
19
 
18
 const actions = {
20
 const actions = {
19
-    getAllExhibitions({ commit },{ sortType, params }) {
21
+    getAllExhibitions({ commit }, { sortType, params }) {
20
         commit('CLEAR_EXHIBITIONS')
22
         commit('CLEAR_EXHIBITIONS')
21
         commit('EXHIBITIONS_LOADED', false)
23
         commit('EXHIBITIONS_LOADED', false)
22
-        const storeFetch = (exhibitions => {
24
+        const storeFetch = exhibitions => {
23
             commit('STORE_FETCHED_EXHIBITIONS', { exhibitions })
25
             commit('STORE_FETCHED_EXHIBITIONS', { exhibitions })
24
             commit('EXHIBITIONS_LOADED', true)
26
             commit('EXHIBITIONS_LOADED', true)
27
+        }
28
+        return api.getByType({
29
+            type: 'exhibition',
30
+            sort: sortType,
31
+            params,
32
+            cb: storeFetch,
25
         })
33
         })
26
-        return api.getByType({ type: 'exhibition', sort: sortType, params, cb: storeFetch })
27
     },
34
     },
28
     getMoreExhibitions({ commit }, { sortType, params }) {
35
     getMoreExhibitions({ commit }, { sortType, params }) {
29
-        const storeFetch = (exhibitions => {
36
+        const storeFetch = exhibitions => {
30
             commit('ADD_TO_FETCHED_EXHIBITIONS', { exhibitions })
37
             commit('ADD_TO_FETCHED_EXHIBITIONS', { exhibitions })
31
             commit('EXHIBITIONS_LOADED', true)
38
             commit('EXHIBITIONS_LOADED', true)
39
+        }
40
+        return api.getByType({
41
+            type: 'exhibition',
42
+            sort: sortType,
43
+            params,
44
+            cb: storeFetch,
32
         })
45
         })
33
-        return api.getByType({ type: 'exhibition', sort: sortType, params, cb: storeFetch })
34
     },
46
     },
35
     getSingleExhibition({ commit }, id) {
47
     getSingleExhibition({ commit }, id) {
36
         commit('CLEAR_SINGLE_EXHIBITIONS')
48
         commit('CLEAR_SINGLE_EXHIBITIONS')
37
         commit('EXHIBITIONS_LOADED', false)
49
         commit('EXHIBITIONS_LOADED', false)
38
-        api.getSingleType('exhibition', id, exhibition => {
50
+        return api.getSingleType('exhibition', id, exhibition => {
39
             commit('STORE_FETCHED_SINGLE_EXHIBITION', exhibition)
51
             commit('STORE_FETCHED_SINGLE_EXHIBITION', exhibition)
40
             commit('EXHIBITIONS_LOADED', true)
52
             commit('EXHIBITIONS_LOADED', true)
41
         })
53
         })

+ 15
- 5
vue-theme/src/store/modules/guide.js Vedi File

17
     getAllGuides({ commit }, { sortType, params }) {
17
     getAllGuides({ commit }, { sortType, params }) {
18
         commit('CLEAR_GUIDES')
18
         commit('CLEAR_GUIDES')
19
         commit('GUIDES_LOADED', false)
19
         commit('GUIDES_LOADED', false)
20
-        const storeFetch = (guides => {
20
+        const storeFetch = guides => {
21
             let repacked = repackBySort(guides, sortType)
21
             let repacked = repackBySort(guides, sortType)
22
             commit('STORE_FETCHED_GUIDES', { guides: repacked })
22
             commit('STORE_FETCHED_GUIDES', { guides: repacked })
23
             commit('GUIDES_LOADED', true)
23
             commit('GUIDES_LOADED', true)
24
+        }
25
+        return api.getByType({
26
+            type: 'guide',
27
+            sort: sortType,
28
+            params,
29
+            cb: storeFetch,
24
         })
30
         })
25
-        return api.getByType({ type: 'guide', sort: sortType, params, cb: storeFetch })
26
     },
31
     },
27
     getMoreGuides({ commit }, { sortType, params }) {
32
     getMoreGuides({ commit }, { sortType, params }) {
28
-        const storeFetch = (guides => {
33
+        const storeFetch = guides => {
29
             let repacked = guides
34
             let repacked = guides
30
             commit('ADD_TO_FETCHED_GUIDES', { guides: repacked })
35
             commit('ADD_TO_FETCHED_GUIDES', { guides: repacked })
31
             commit('GUIDES_LOADED', true)
36
             commit('GUIDES_LOADED', true)
37
+        }
38
+        return api.getByType({
39
+            type: 'guide',
40
+            sort: sortType,
41
+            params,
42
+            cb: storeFetch,
32
         })
43
         })
33
-        return api.getByType({ type: 'guide', sort: sortType, params, cb: storeFetch })
34
     },
44
     },
35
     getSingleGuide({ commit }, id) {
45
     getSingleGuide({ commit }, id) {
36
         commit('CLEAR_SINGLE_GUIDES')
46
         commit('CLEAR_SINGLE_GUIDES')
37
         commit('GUIDES_LOADED', false)
47
         commit('GUIDES_LOADED', false)
38
 
48
 
39
-        api.getSingleType('guide', id, guide => {
49
+        return api.getSingleType('guide', id, guide => {
40
             commit('STORE_FETCHED_SINGLE_GUIDE', guide)
50
             commit('STORE_FETCHED_SINGLE_GUIDE', guide)
41
             commit('GUIDES_LOADED', true)
51
             commit('GUIDES_LOADED', true)
42
         })
52
         })

+ 15
- 5
vue-theme/src/store/modules/object.js Vedi File

17
     getAllObjects({ commit }, { sortType, params }) {
17
     getAllObjects({ commit }, { sortType, params }) {
18
         commit('CLEAR_OBJECTS')
18
         commit('CLEAR_OBJECTS')
19
         commit('OBJECTS_LOADED', false)
19
         commit('OBJECTS_LOADED', false)
20
-        const storeFetch = (objects => {
20
+        const storeFetch = objects => {
21
             let repacked = repackBySort(objects, sortType)
21
             let repacked = repackBySort(objects, sortType)
22
             commit('STORE_FETCHED_OBJECTS', { objects: repacked })
22
             commit('STORE_FETCHED_OBJECTS', { objects: repacked })
23
             commit('OBJECTS_LOADED', true)
23
             commit('OBJECTS_LOADED', true)
24
+        }
25
+        return api.getByType({
26
+            type: 'object',
27
+            sort: sortType,
28
+            params,
29
+            cb: storeFetch,
24
         })
30
         })
25
-        return api.getByType({ type: 'object', sort: sortType, params, cb: storeFetch })
26
     },
31
     },
27
     getMoreObjects({ commit }, { sortType, params }) {
32
     getMoreObjects({ commit }, { sortType, params }) {
28
-        const storeFetch = (objects => {
33
+        const storeFetch = objects => {
29
             let repacked = objects
34
             let repacked = objects
30
             commit('ADD_TO_FETCHED_OBJECTS', { objects: repacked })
35
             commit('ADD_TO_FETCHED_OBJECTS', { objects: repacked })
31
             commit('OBJECTS_LOADED', true)
36
             commit('OBJECTS_LOADED', true)
37
+        }
38
+        return api.getByType({
39
+            type: 'object',
40
+            sort: sortType,
41
+            params,
42
+            cb: storeFetch,
32
         })
43
         })
33
-        return api.getByType({ type: 'object', sort: sortType, params, cb: storeFetch })
34
     },
44
     },
35
     getSingleObject({ commit }, id) {
45
     getSingleObject({ commit }, id) {
36
         commit('CLEAR_SINGLE_OBJECTS')
46
         commit('CLEAR_SINGLE_OBJECTS')
37
         commit('OBJECTS_LOADED', false)
47
         commit('OBJECTS_LOADED', false)
38
 
48
 
39
-        api.getSingleType('object', id, object => {
49
+        return api.getSingleType('object', id, object => {
40
             commit('STORE_FETCHED_SINGLE_OBJECT', object)
50
             commit('STORE_FETCHED_SINGLE_OBJECT', object)
41
             commit('OBJECTS_LOADED', true)
51
             commit('OBJECTS_LOADED', true)
42
         })
52
         })

+ 2
- 2
vue-theme/src/store/modules/page.js Vedi File

24
             cb: pages => {
24
             cb: pages => {
25
                 commit('STORE_FETCHED_PAGES', { pages })
25
                 commit('STORE_FETCHED_PAGES', { pages })
26
                 commit('PAGES_LOADED', true)
26
                 commit('PAGES_LOADED', true)
27
-            }
27
+            },
28
         })
28
         })
29
     },
29
     },
30
     getSinglePage({ commit }, id) {
30
     getSinglePage({ commit }, id) {
31
         commit('CLEAR_SINGLE_PAGE')
31
         commit('CLEAR_SINGLE_PAGE')
32
         commit('PAGES_LOADED', false)
32
         commit('PAGES_LOADED', false)
33
-        api.getSingleType('page', id, page => {
33
+        return api.getSingleType('page', id, page => {
34
             commit('STORE_FETCHED_SINGLE_PAGE', page)
34
             commit('STORE_FETCHED_SINGLE_PAGE', page)
35
             commit('PAGES_LOADED', true)
35
             commit('PAGES_LOADED', true)
36
         })
36
         })

+ 18
- 8
vue-theme/src/store/modules/post.js Vedi File

17
     postsList.forEach(post => {
17
     postsList.forEach(post => {
18
         const subtypes = post.categories
18
         const subtypes = post.categories
19
         subtypes.forEach(type => {
19
         subtypes.forEach(type => {
20
-            if(!byType[type]) byType[type] = []
20
+            if (!byType[type]) byType[type] = []
21
             byType[type].push(post)
21
             byType[type].push(post)
22
         })
22
         })
23
     })
23
     })
33
     async getAllPosts({ commit }, { sortType, params }) {
33
     async getAllPosts({ commit }, { sortType, params }) {
34
         commit('CLEAR_POSTS')
34
         commit('CLEAR_POSTS')
35
         commit('POSTS_LOADED', false)
35
         commit('POSTS_LOADED', false)
36
-        const storeFetch = (posts => {
36
+        const storeFetch = posts => {
37
             let repacked = posts
37
             let repacked = posts
38
-            if(sortType == sortTypes.subtype) {
38
+            if (sortType == sortTypes.subtype) {
39
                 repacked = _arrangeByType(posts)
39
                 repacked = _arrangeByType(posts)
40
             }
40
             }
41
             commit('STORE_FETCHED_POSTS', { posts: repacked })
41
             commit('STORE_FETCHED_POSTS', { posts: repacked })
42
             commit('POSTS_LOADED', true)
42
             commit('POSTS_LOADED', true)
43
-        }) 
44
-        return await api.getByType({ type: 'post', sort: sortType, params, cb: storeFetch })
43
+        }
44
+        return await api.getByType({
45
+            type: 'post',
46
+            sort: sortType,
47
+            params,
48
+            cb: storeFetch,
49
+        })
45
     },
50
     },
46
     getMorePosts({ commit }, { sortType, params }) {
51
     getMorePosts({ commit }, { sortType, params }) {
47
-        const storeFetch = (posts => {
52
+        const storeFetch = posts => {
48
             commit('ADD_TO_FETCHED_POSTS', { posts })
53
             commit('ADD_TO_FETCHED_POSTS', { posts })
49
             commit('POSTS_LOADED', true)
54
             commit('POSTS_LOADED', true)
55
+        }
56
+        return api.getByType({
57
+            type: 'post',
58
+            sort: sortType,
59
+            params,
60
+            cb: storeFetch,
50
         })
61
         })
51
-        return api.getByType({ type: 'post', sort: sortType, params, cb: storeFetch })
52
     },
62
     },
53
     getSinglePost({ commit }, id) {
63
     getSinglePost({ commit }, id) {
54
         commit('CLEAR_SINGLE_POSTS')
64
         commit('CLEAR_SINGLE_POSTS')
55
         commit('POSTS_LOADED', false)
65
         commit('POSTS_LOADED', false)
56
-        api.getSingleType('post', id, post => {
66
+        return api.getSingleType('post', id, post => {
57
             commit('STORE_FETCHED_SINGLE_POST', post)
67
             commit('STORE_FETCHED_SINGLE_POST', post)
58
             commit('POSTS_LOADED', true)
68
             commit('POSTS_LOADED', true)
59
         })
69
         })

+ 15
- 5
vue-theme/src/store/modules/publication.js Vedi File

17
     getAllPublications({ commit }, { sortType, params }) {
17
     getAllPublications({ commit }, { sortType, params }) {
18
         commit('CLEAR_PUBLICATIONS')
18
         commit('CLEAR_PUBLICATIONS')
19
         commit('PUBLICATIONS_LOADED', false)
19
         commit('PUBLICATIONS_LOADED', false)
20
-        const storeFetch = (publications => {
20
+        const storeFetch = publications => {
21
             let repacked = repackBySort(publications, sortType)
21
             let repacked = repackBySort(publications, sortType)
22
             commit('STORE_FETCHED_PUBLICATIONS', { publications: repacked })
22
             commit('STORE_FETCHED_PUBLICATIONS', { publications: repacked })
23
             commit('PUBLICATIONS_LOADED', true)
23
             commit('PUBLICATIONS_LOADED', true)
24
+        }
25
+        return api.getByType({
26
+            type: 'publication',
27
+            sort: sortType,
28
+            params,
29
+            cb: storeFetch,
24
         })
30
         })
25
-        return api.getByType({ type: 'publication', sort: sortType, params, cb: storeFetch })
26
     },
31
     },
27
     getMorePublications({ commit }, { sortType, params }) {
32
     getMorePublications({ commit }, { sortType, params }) {
28
-        const storeFetch = (publications => {
33
+        const storeFetch = publications => {
29
             let repacked = publications
34
             let repacked = publications
30
             commit('ADD_TO_FETCHED_PUBLICATIONS', { publications: repacked })
35
             commit('ADD_TO_FETCHED_PUBLICATIONS', { publications: repacked })
31
             commit('PUBLICATIONS_LOADED', true)
36
             commit('PUBLICATIONS_LOADED', true)
37
+        }
38
+        return api.getByType({
39
+            type: 'publication',
40
+            sort: sortType,
41
+            params,
42
+            cb: storeFetch,
32
         })
43
         })
33
-        return api.getByType({ type: 'publication', sort: sortType, params, cb: storeFetch })
34
     },
44
     },
35
     getSinglePublication({ commit }, id) {
45
     getSinglePublication({ commit }, id) {
36
         commit('CLEAR_SINGLE_PUBLICATIONS')
46
         commit('CLEAR_SINGLE_PUBLICATIONS')
37
         commit('PUBLICATIONS_LOADED', false)
47
         commit('PUBLICATIONS_LOADED', false)
38
 
48
 
39
-        api.getSingleType('publication', id, publication => {
49
+        return api.getSingleType('publication', id, publication => {
40
             commit('STORE_FETCHED_SINGLE_PUBLICATION', publication)
50
             commit('STORE_FETCHED_SINGLE_PUBLICATION', publication)
41
             commit('PUBLICATIONS_LOADED', true)
51
             commit('PUBLICATIONS_LOADED', true)
42
         })
52
         })

+ 15
- 5
vue-theme/src/store/modules/short.js Vedi File

17
     getAllShorts({ commit }, { sortType, params }) {
17
     getAllShorts({ commit }, { sortType, params }) {
18
         commit('CLEAR_SHORTS')
18
         commit('CLEAR_SHORTS')
19
         commit('SHORTS_LOADED', false)
19
         commit('SHORTS_LOADED', false)
20
-        const storeFetch = (shorts => {
20
+        const storeFetch = shorts => {
21
             let repacked = repackBySort(shorts, sortType)
21
             let repacked = repackBySort(shorts, sortType)
22
             commit('STORE_FETCHED_SHORTS', { shorts: repacked })
22
             commit('STORE_FETCHED_SHORTS', { shorts: repacked })
23
             commit('SHORTS_LOADED', true)
23
             commit('SHORTS_LOADED', true)
24
+        }
25
+        return api.getByType({
26
+            type: 'short',
27
+            sort: sortType,
28
+            params,
29
+            cb: storeFetch,
24
         })
30
         })
25
-        return api.getByType({ type: 'short', sort: sortType, params, cb: storeFetch })
26
     },
31
     },
27
     getMoreShorts({ commit }, { sortType, params }) {
32
     getMoreShorts({ commit }, { sortType, params }) {
28
-        const storeFetch = (shorts => {
33
+        const storeFetch = shorts => {
29
             let repacked = shorts
34
             let repacked = shorts
30
             commit('ADD_TO_FETCHED_SHORTS', { shorts: repacked })
35
             commit('ADD_TO_FETCHED_SHORTS', { shorts: repacked })
31
             commit('SHORTS_LOADED', true)
36
             commit('SHORTS_LOADED', true)
37
+        }
38
+        return api.getByType({
39
+            type: 'short',
40
+            sort: sortType,
41
+            params,
42
+            cb: storeFetch,
32
         })
43
         })
33
-        return api.getByType({ type: 'short', sort: sortType, params, cb: storeFetch })
34
     },
44
     },
35
     getSingleShort({ commit }, id) {
45
     getSingleShort({ commit }, id) {
36
         commit('CLEAR_SINGLE_SHORTS')
46
         commit('CLEAR_SINGLE_SHORTS')
37
         commit('SHORTS_LOADED', false)
47
         commit('SHORTS_LOADED', false)
38
 
48
 
39
-        api.getSingleType('short', id, short => {
49
+        return api.getSingleType('short', id, short => {
40
             commit('STORE_FETCHED_SINGLE_SHORT', short)
50
             commit('STORE_FETCHED_SINGLE_SHORT', short)
41
             commit('SHORTS_LOADED', true)
51
             commit('SHORTS_LOADED', true)
42
         })
52
         })

+ 15
- 5
vue-theme/src/store/modules/technique.js Vedi File

17
     getAllTechniques({ commit }, { sortType, params }) {
17
     getAllTechniques({ commit }, { sortType, params }) {
18
         commit('CLEAR_TECHNIQUES')
18
         commit('CLEAR_TECHNIQUES')
19
         commit('TECHNIQUES_LOADED', false)
19
         commit('TECHNIQUES_LOADED', false)
20
-        const storeFetch = (techniques => {
20
+        const storeFetch = techniques => {
21
             let repacked = repackBySort(techniques, sortType)
21
             let repacked = repackBySort(techniques, sortType)
22
             commit('STORE_FETCHED_TECHNIQUES', { techniques: repacked })
22
             commit('STORE_FETCHED_TECHNIQUES', { techniques: repacked })
23
             commit('TECHNIQUES_LOADED', true)
23
             commit('TECHNIQUES_LOADED', true)
24
+        }
25
+        return api.getByType({
26
+            type: 'technique',
27
+            sort: sortType,
28
+            params,
29
+            cb: storeFetch,
24
         })
30
         })
25
-        return api.getByType({ type: 'technique', sort: sortType, params, cb: storeFetch })
26
     },
31
     },
27
     getMoreTechniques({ commit }, { sortType, params }) {
32
     getMoreTechniques({ commit }, { sortType, params }) {
28
-        const storeFetch = (techniques => {
33
+        const storeFetch = techniques => {
29
             let repacked = techniques
34
             let repacked = techniques
30
             commit('ADD_TO_FETCHED_TECHNIQUES', { techniques: repacked })
35
             commit('ADD_TO_FETCHED_TECHNIQUES', { techniques: repacked })
31
             commit('TECHNIQUES_LOADED', true)
36
             commit('TECHNIQUES_LOADED', true)
37
+        }
38
+        return api.getByType({
39
+            type: 'technique',
40
+            sort: sortType,
41
+            params,
42
+            cb: storeFetch,
32
         })
43
         })
33
-        return api.getByType({ type: 'technique', sort: sortType, params, cb: storeFetch })
34
     },
44
     },
35
     getSingleTechnique({ commit }, id) {
45
     getSingleTechnique({ commit }, id) {
36
         commit('CLEAR_SINGLE_TECHNIQUES')
46
         commit('CLEAR_SINGLE_TECHNIQUES')
37
         commit('TECHNIQUES_LOADED', false)
47
         commit('TECHNIQUES_LOADED', false)
38
 
48
 
39
-        api.getSingleType('technique', id, technique => {
49
+        return api.getSingleType('technique', id, technique => {
40
             commit('STORE_FETCHED_SINGLE_TECHNIQUE', technique)
50
             commit('STORE_FETCHED_SINGLE_TECHNIQUE', technique)
41
             commit('TECHNIQUES_LOADED', true)
51
             commit('TECHNIQUES_LOADED', true)
42
         })
52
         })

+ 10
- 10
vue-theme/src/utils/api.js Vedi File

7
     API_MEDIA_PATH: '/wp-json/wp/v2/media/',
7
     API_MEDIA_PATH: '/wp-json/wp/v2/media/',
8
 }
8
 }
9
 
9
 
10
-const constructQuery = (params) => {
10
+const constructQuery = params => {
11
     let query = ''
11
     let query = ''
12
-    
13
-    if(!params) return query
14
 
12
 
15
-    if(params.limit && params.page && params.s) {
13
+    if (!params) return query
14
+
15
+    if (params.limit && params.page && params.s) {
16
         query = `?s=${params.s}&limit=${params.limit}&p=${params.page}`
16
         query = `?s=${params.s}&limit=${params.limit}&p=${params.page}`
17
-    } else if(params.limit && params.page && !params.s && params.type) {
17
+    } else if (params.limit && params.page && !params.s && params.type) {
18
         query = `?type=${params.type}&limit=${params.limit}&p=${params.page}`
18
         query = `?type=${params.type}&limit=${params.limit}&p=${params.page}`
19
-    } else if(params.limit && params.page && !params.s) {
19
+    } else if (params.limit && params.page && !params.s) {
20
         query = `?limit=${params.limit}&p=${params.page}`
20
         query = `?limit=${params.limit}&p=${params.page}`
21
-    } else if(params.limit && !params.page) {
21
+    } else if (params.limit && !params.page) {
22
         query = `?limit=${params.limit}`
22
         query = `?limit=${params.limit}`
23
     }
23
     }
24
     return query
24
     return query
52
         }
52
         }
53
     },
53
     },
54
     async getSingleType(type, id, cb) {
54
     async getSingleType(type, id, cb) {
55
-        await axios
55
+        return await axios
56
             .get(SETTINGS.API_BASE_PATH + `${type}/${id}`)
56
             .get(SETTINGS.API_BASE_PATH + `${type}/${id}`)
57
             .then(response => {
57
             .then(response => {
58
                 cb(Object.values(response.data)[0])
58
                 cb(Object.values(response.data)[0])
73
     },
73
     },
74
     async getRandom(types, cb) {
74
     async getRandom(types, cb) {
75
         let randomPosts = []
75
         let randomPosts = []
76
-        for(let type of types) {
76
+        for (let type of types) {
77
             await axios
77
             await axios
78
                 .get(SETTINGS.API_BASE_PATH + `${type}?orderby=rand&limit=1`)
78
                 .get(SETTINGS.API_BASE_PATH + `${type}?orderby=rand&limit=1`)
79
                 .then(response => {
79
                 .then(response => {
101
             .catch(e => {
101
             .catch(e => {
102
                 cb(e)
102
                 cb(e)
103
             })
103
             })
104
-    }
104
+    },
105
 }
105
 }

+ 1
- 1
vue-theme/src/utils/helpers.js Vedi File

7
 
7
 
8
 const sortTypes = {
8
 const sortTypes = {
9
     alpha: 'by-alpha',
9
     alpha: 'by-alpha',
10
-u    material: 'by-material',
10
+    material: 'by-material',
11
     artist: 'by-artist',
11
     artist: 'by-artist',
12
     episode: 'by-episode',
12
     episode: 'by-episode',
13
     upcoming: 'by-upcoming',
13
     upcoming: 'by-upcoming',

+ 1
- 1
vue-theme/style.css Vedi File

7
 Version: 1.0.0
7
 Version: 1.0.0
8
 License: MIT
8
 License: MIT
9
 Contributors: Sagar Bhatt, Pradeep Sonawane
9
 Contributors: Sagar Bhatt, Pradeep Sonawane
10
-*/
10
+*/

Loading…
Annulla
Salva