druxt-router 0.27.0 → 0.27.3

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.
Files changed (2) hide show
  1. package/nuxt/index.js +7 -4
  2. package/package.json +2 -2
package/nuxt/index.js CHANGED
@@ -30,15 +30,18 @@ const DruxtRouterNuxtModule = async function(moduleOptions = {}) {
30
30
  fileName: "components/druxt-router.js",
31
31
  options
32
32
  });
33
+ let languages = [];
33
34
  const druxt$1 = new druxt.DruxtClient(options.baseUrl, {
34
35
  ...options,
35
36
  proxy: { ...options.proxy || {}, api: false }
36
37
  });
37
- const resourceType = "configurable_language--configurable_language";
38
- const query = new drupalJsonapiParams.DrupalJsonApiParams().addFields(resourceType, ["drupal_internal__id"]);
39
- const languages = (await druxt$1.getCollectionAll(resourceType, query) || []).map((o) => o.data).flat().filter((o) => !["und", "zxx"].includes(o.attributes.drupal_internal__id));
38
+ const languageResourceType = "configurable_language--configurable_language";
39
+ if ((await druxt$1.getIndex(languageResourceType) || {}).href) {
40
+ const query = new drupalJsonapiParams.DrupalJsonApiParams().addFields(languageResourceType, ["drupal_internal__id"]);
41
+ languages = (await druxt$1.getCollectionAll(languageResourceType, query) || []).map((o) => o.data).flat().filter((o) => !["und", "zxx"].includes(((o || {}).attributes || {}).drupal_internal__id));
42
+ }
40
43
  this.extendRoutes((routes) => {
41
- languages.forEach((o) => {
44
+ languages.filter((o) => o).forEach((o) => {
42
45
  routes.push({
43
46
  name: `druxt-router__${o.attributes.drupal_internal__id}`,
44
47
  path: `/${o.attributes.drupal_internal__id}*`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "druxt-router",
3
- "version": "0.27.0",
3
+ "version": "0.27.3",
4
4
  "description": "Drupal router for Nuxt, powered by the Drupal Decoupled Router module.",
5
5
  "keywords": [
6
6
  "cms",
@@ -42,7 +42,7 @@
42
42
  "templates"
43
43
  ],
44
44
  "dependencies": {
45
- "druxt": "^0.19.0",
45
+ "druxt": "^0.19.2",
46
46
  "url-parse": "^1.5.10"
47
47
  },
48
48
  "devDependencies": {