Skip to content

Commit

Permalink
get workspace from module in getLayer
Browse files Browse the repository at this point in the history
  • Loading branch information
dbauszus-glx committed Oct 26, 2023
1 parent 6a83556 commit 8c0387c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
4 changes: 3 additions & 1 deletion mod/workspace/getLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ const merge = require('../utils/merge')

const getTemplate = require('./getTemplate')

const workspaceCache = require('./cache')

module.exports = async (req) => {

const workspace = req.params.workspace
const workspace = await workspaceCache()

if (!Object.hasOwn(workspace.locales, req.params.locale)) {
return new Error('Unable to validate locale param.') //400
Expand Down
8 changes: 1 addition & 7 deletions mod/workspace/getTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,7 @@ module.exports = async (template) => {
return template
}

if (typeof getFrom[template.src.split(':')[0]] !== 'function') {

console.warn(`getFrom[${template.src.split(':')[0]}] is not a method.`);
return template
}

const response = await getFrom[template.src.split(':')[0]]?.(template.src)
const response = await getFrom[template.src.split(':')[0]](template.src)

if (response instanceof Error) {

Expand Down

0 comments on commit 8c0387c

Please sign in to comment.