Skip to content

Commit

Permalink
chore(#158): update multilingual support
Browse files Browse the repository at this point in the history
  • Loading branch information
0xIml337 authored and Decipher committed Jan 19, 2022
1 parent c1eb068 commit 8cd9a2e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
8 changes: 4 additions & 4 deletions packages/druxt/src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,8 @@ class DruxtClient {
return this.index[resource] ? this.index[resource] : false
}

const url = this.options.endpoint
const { data } = await this.get(prefix + url)
const url = prefix + this.options.endpoint
const { data } = await this.get(url)
let index = data.links

// Throw error if index is invalid.
Expand Down Expand Up @@ -401,12 +401,12 @@ class DruxtClient {
*
* @returns {object} The related JSON:API resource(s).
*/
async getRelated(type, id, related, query) {
async getRelated(type, id, related, query, prefix = '') {
if (!id || !type || !related) {
return false
}

let { href } = await this.getIndex(type)
let { href } = await this.getIndex(type, prefix)
if (!href) {
href = this.options.endpoint + '/' + type.replace('--', '/')
}
Expand Down
4 changes: 2 additions & 2 deletions packages/menu/src/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class DruxtMenu {
* @param {string} menuName - The menu name.
* @param {object} settings - The Druxt Menu query settings object.
*/
async get(menuName, settings, prefix) {
async get(menuName, settings, prefix = '') {
if (this.options.menu.jsonApiMenuItems) {
return this.getJsonApiMenuItems(menuName, settings, prefix)
}
Expand All @@ -102,7 +102,7 @@ class DruxtMenu {
* @param {string} menuName - The menu name.
* @param {object} settings - The Druxt Menu query settings object.
*/
async getMenuLinkContent(menuName, settings) {
async getMenuLinkContent(menuName, settings, prefix) {
const resource = 'menu_link_content--menu_link_content'
const requiredFields = ['bundle', 'link', 'menu_name', 'parent', 'title', 'weight']

Expand Down
3 changes: 1 addition & 2 deletions packages/router/src/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,12 +317,11 @@ class DruxtRouter {
isHomePath: data.isHomePath,
jsonapi: data.jsonapi,
label: data.label,
prefix: langcode,
props: false,
redirect: data.redirect,
resolvedPath: Url(data.resolved).pathname,
prefix: langcode,
entity: data.entity

}

// Determine route type by configuration.
Expand Down

0 comments on commit 8cd9a2e

Please sign in to comment.