Skip to content

Commit

Permalink
Fix project vocabularies.
Browse files Browse the repository at this point in the history
  • Loading branch information
robgietema committed Oct 6, 2023
1 parent 17ef4e2 commit e0a374b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/routes/vocabularies/vocabularies.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ export default [
permission: 'View',
handler: async (req, trx) => {
// Check if vocabulary is available
if (!includes(keys(vocabularies, req.param.id)) &&
!includes(keys(config.vocabularies), req.params.id)) {
if (
!includes(keys(vocabularies), req.params.id) &&
!includes(keys(config.vocabularies || {}), req.params.id)
) {
const vocabulary = await Vocabulary.fetchById(req.params.id, {}, trx);
if (!vocabulary) {
throw new RequestException(404, { error: req.i18n('Not found.') });
Expand All @@ -59,9 +61,9 @@ export default [
}

// Get items
const items = includes(keys(vocabularies), req.param.id) ?
await vocabularies[req.params.id](req) :
await config.vocabularies[req.params.id](req);
const items = includes(keys(vocabularies), req.params.id)
? await vocabularies[req.params.id](req)
: await config.vocabularies[req.params.id](req);

// Return data
return {
Expand Down

0 comments on commit e0a374b

Please sign in to comment.