Skip to content

Commit

Permalink
refactor category list
Browse files Browse the repository at this point in the history
  • Loading branch information
talvasconcelos committed Feb 7, 2024
1 parent 240de05 commit 21d23c4
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions templates/tpos/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -859,17 +859,13 @@ <h6 class="text-subtitle1 q-my-none">
},
computed: {
categoryList() {
return this.tposs.reduce((acc, tpos) => {
tpos.items.forEach(item => {
item.categories &&
item.categories.forEach(category => {
if (!acc.includes(category)) {
acc.push(category)
}
})
})
return acc
}, [])
return Array.from(
new Set(
this.tposs.flatMap(tpos =>
tpos.items.flatMap(item => item.categories || [])
)
)
)
}
},
methods: {
Expand Down

0 comments on commit 21d23c4

Please sign in to comment.