@q2devel/q2-core 1.0.14 → 1.0.15
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page.service.d.ts","sourceRoot":"","sources":["../../../../api/pages/page/page.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"page.service.d.ts","sourceRoot":"","sources":["../../../../api/pages/page/page.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAE1C,KAAK,YAAY,GAAG;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,KAAK,IAAI,CAAA;CACzC,CAAA;AAED,eAAO,MAAM,OAAO,GAChB,KAAK,WAAW,EAChB,4BAA4C,YAAY,KACzD,OAAO,CAAC,IAAI,GAAG,IAAI,CA8CrB,CAAA"}
|
|
@@ -3,13 +3,15 @@ import mapIncludedResources from '../../../utils/mapIncludedResources';
|
|
|
3
3
|
export const getPage = async (ctx, { pageId, include = ['node_type'], mapFn }) => {
|
|
4
4
|
const cacheKey = ['page', ctx.locale, pageId].join(':');
|
|
5
5
|
if (ctx.getCache) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
try {
|
|
7
|
+
const cached = await ctx.getCache(cacheKey);
|
|
8
|
+
if (cached)
|
|
9
|
+
return cached;
|
|
10
|
+
}
|
|
11
|
+
catch (error) {
|
|
12
|
+
}
|
|
9
13
|
}
|
|
10
|
-
const url = ctx.locale === ctx.defaultLocale
|
|
11
|
-
? `/jsonapi/node/page`
|
|
12
|
-
: `/${ctx.locale}/jsonapi/node/page`;
|
|
14
|
+
const url = ctx.locale === ctx.defaultLocale ? `/jsonapi/node/page` : `/${ctx.locale}/jsonapi/node/page`;
|
|
13
15
|
const params = new DrupalJsonApiParams()
|
|
14
16
|
.addFilter('drupal_internal__nid', pageId)
|
|
15
17
|
.addFilter('langcode', ctx.locale)
|
|
@@ -30,7 +32,11 @@ export const getPage = async (ctx, { pageId, include = ['node_type'], mapFn }) =
|
|
|
30
32
|
});
|
|
31
33
|
const page = mappedPages[0];
|
|
32
34
|
if (ctx.setCache) {
|
|
33
|
-
|
|
35
|
+
try {
|
|
36
|
+
await ctx.setCache(cacheKey, page);
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
}
|
|
34
40
|
}
|
|
35
41
|
return page;
|
|
36
42
|
};
|