Skip to content

Commit

Permalink
feat: support operators local storage operators
Browse files Browse the repository at this point in the history
  • Loading branch information
frankpagan committed May 7, 2024
1 parent 1002c2a commit bb79f3b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ async function updateFilter(element, loadMore) {
els = [element]
for (let i = 0; i < els.length; i++) {
let filter = filters.get(els[i])
if (!filter)
return filter = { isFilter: false }
if (newFilter) {
filter.query = { ...filter.query, ...newFilter.query }
if (newFilter.sort)
Expand Down Expand Up @@ -198,12 +200,12 @@ async function applyQuery(filter, element) {
if (!value && element.value !== undefined)
value = await element.getValue() || '';

// TODO: Improve autorization then test to see if still required
if (!value && element.value === '$user_id')
value = '$user_id'
const keys = ['$organization_id', '$user_id', '$clientId', '$session_id'];
if (!value && keys.includes(element.value))
value = element.getAttribute('value')

if (!key || !value)
return
return filter.isFilter = false

if (!checkValue(key) || !checkValue(value) || !checkValue(type) || !checkValue(operator))
return filter.isFilter = false
Expand Down

0 comments on commit bb79f3b

Please sign in to comment.