@lancom/shared 0.0.471 → 0.0.473
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/mixins/layouts/products.js +6 -27
- package/nuxt.config.js +2 -3
- package/package.json +1 -1
|
@@ -8,36 +8,15 @@ import { getProductLargeCover, getProductMediumCover } from '@lancom/shared/asse
|
|
|
8
8
|
export default {
|
|
9
9
|
mixins: [metaInfo],
|
|
10
10
|
middleware: ['page-info'],
|
|
11
|
-
async
|
|
12
|
-
|
|
13
|
-
const country = store.getters.country;
|
|
14
|
-
const currency = store.getters.currency;
|
|
11
|
+
async fetch() {
|
|
12
|
+
await this.loadProducts();
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
...route.query,
|
|
19
|
-
country: country?._id,
|
|
20
|
-
currency: currency?._id,
|
|
21
|
-
limit: 80
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
try {
|
|
25
|
-
await store.dispatch('products/fetchProducts', { params, shop: shop._id });
|
|
26
|
-
} catch {
|
|
27
|
-
if (process.server && res) {
|
|
28
|
-
const loadError = store.getters['products/loadError'];
|
|
29
|
-
res.statusCode = loadError?.statusCode || 500;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const page = store.getters['products/page'];
|
|
34
|
-
if (page === 1) {
|
|
35
|
-
const category = store.getters['products/category'];
|
|
36
|
-
await store.dispatch('products/fetchChildrenCategories', { category, shop });
|
|
14
|
+
if (this.page === 1) {
|
|
15
|
+
await this.fetchChildrenCategories(this.currentCategory);
|
|
37
16
|
}
|
|
38
17
|
|
|
39
|
-
if (process.server
|
|
40
|
-
res
|
|
18
|
+
if (process.server) {
|
|
19
|
+
this.$root.context?.res?.setHeader('Cache-Control', `max-age=${86400}`);;
|
|
41
20
|
}
|
|
42
21
|
},
|
|
43
22
|
computed: {
|
package/nuxt.config.js
CHANGED
|
@@ -53,7 +53,6 @@ module.exports = (config, axios, { raygunClient, publicPath, productUrlToEditor,
|
|
|
53
53
|
lastmod: formatSitemapDate(getCurrentMonthFirstDay())
|
|
54
54
|
},
|
|
55
55
|
exclude: [
|
|
56
|
-
// '/',
|
|
57
56
|
'/faq',
|
|
58
57
|
'/quotes/request',
|
|
59
58
|
sitemapWithoutProductTypes ? '/products' : null,
|
|
@@ -69,10 +68,10 @@ module.exports = (config, axios, { raygunClient, publicPath, productUrlToEditor,
|
|
|
69
68
|
return [
|
|
70
69
|
{ url: '/', lastmod: defaultLastmod },
|
|
71
70
|
...data.map(item => {
|
|
72
|
-
const url = item.url || item.link
|
|
71
|
+
const url = item.url || item.link;
|
|
73
72
|
const updatedAt = item.updatedAt;
|
|
74
73
|
return {
|
|
75
|
-
url,
|
|
74
|
+
url: typeof url === 'string' ? url : item,
|
|
76
75
|
lastmod: updatedAt ? formatSitemapDate(new Date(updatedAt)) : defaultLastmod
|
|
77
76
|
};
|
|
78
77
|
})
|