Skip to content

Commit

Permalink
fix: await key to resolve, update filters
Browse files Browse the repository at this point in the history
  • Loading branch information
frankpagan committed Oct 26, 2023
1 parent 73936c9 commit f69bdb7
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@

async function getAuthorization(key, organization_id) {
// Check if there is a value orpending promise for this key
if (authorizations.has(key)) {
if (key && authorizations.has(key)) {
// Return the value or pending promise
return authorizations.get(key);
return await authorizations.get(key);
}

// Create a new promise and store it
Expand Down Expand Up @@ -97,17 +97,16 @@
method: 'read.object',
array: 'keys',
organization_id,
object: {
$filter: {
query: []
}
object: {},
$filter: {
query: []
}
}

if (key)
request.object.$filter.query.push({ key: 'key', value: key, operator: '$eq' })
request.$filter.query.push({ key: 'key', value: key, operator: '$eq' })
else
request.object.$filter.query.push({ key: 'default', value: true, operator: '$eq' })
request.$filter.query.push({ key: 'default', value: true, operator: '$eq' })


let authorization = await crud.send(request)
Expand Down

0 comments on commit f69bdb7

Please sign in to comment.