I am currently working on my Vue app and aiming to filter a list to display only entries that have been moderated.
However, I am encountering an issue where when the checkbox is checked, I receive all the results that are true, and when the checkbox is unchecked, I get all the results that are false. What I actually want is for no filtering to occur when the checkbox is empty, and to only show results that have been moderated when the checkbox is checked.
Below is what I have tried:
<input type="checkbox" v-model="showUnModerated" /> Show only unmoderated listings</label>
Here is my filtering code:
return this.listing.listings.filter(listing => (this.showUnModerated ? 1 : 0) === listing.moderated);