Skip to content

Commit

Permalink
fix(#515): fix json:api extras single lingual bug (#516)
Browse files Browse the repository at this point in the history
  • Loading branch information
Decipher authored May 29, 2022
1 parent 7aa6f47 commit 9819eee
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changeset/empty-eels-float.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"druxt": patch
"druxt-router": patch
---

Fixed issue with single lingual sites using JSON:API Extras.
2 changes: 1 addition & 1 deletion packages/druxt/src/nuxt/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const DruxtNuxtModule = async function (moduleOptions = {}) {

// Langcode prefixed API endpoints.
const languageResourceType = 'configurable_language--configurable_language'
if (await druxt.getIndex(languageResourceType)) {
if (((await druxt.getIndex(languageResourceType)) || {}).href) {
const query = new DrupalJsonApiParams().addFields(languageResourceType, ['drupal_internal__id'])
const languages = (await druxt.getCollectionAll(languageResourceType, query) || [])
.map((o) => o.data)
Expand Down
2 changes: 1 addition & 1 deletion packages/router/src/nuxt/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const DruxtRouterNuxtModule = async function (moduleOptions = {}) {
proxy: { ...options.proxy || {}, api: false },
})
const languageResourceType = 'configurable_language--configurable_language'
if (await druxt.getIndex(languageResourceType)) {
if (((await druxt.getIndex(languageResourceType)) || {}).href) {
const query = new DrupalJsonApiParams().addFields(languageResourceType, ['drupal_internal__id'])
languages = (await druxt.getCollectionAll(languageResourceType, query) || [])
.map((o) => o.data)
Expand Down

0 comments on commit 9819eee

Please sign in to comment.