diff --git a/src/utils/getFilterbylabel.js b/src/utils/getFilterbylabel.js new file mode 100644 index 0000000..a0128c1 --- /dev/null +++ b/src/utils/getFilterbylabel.js @@ -0,0 +1,9 @@ +export const filterbyLabels = (state, notes) => { + if (state.tags.length !== 0) { + return notes.filter( + (item) => + item.Note.labels.filter((tag) => state.tags.includes(tag)).length > 0 + ); + } + return notes; + }; \ No newline at end of file