Chnages in Directory for fetching data.
This commit is contained in:
parent
2df8187ade
commit
a2761bdd4c
@ -13,7 +13,7 @@ const NotesCardViewDirectory = ({ notes, setNotes, searchText, selectedNoteNames
|
|||||||
const fetchNotes = async () => {
|
const fetchNotes = async () => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
try {
|
||||||
const response = await DirectoryRepository.GetNotes(20, 1);
|
const response = await DirectoryRepository.GetNotes(1000, 1);
|
||||||
const fetchedNotes = response.data?.data || [];
|
const fetchedNotes = response.data?.data || [];
|
||||||
setAllNotes(fetchedNotes);
|
setAllNotes(fetchedNotes);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -27,34 +27,6 @@ const NotesCardViewDirectory = ({ notes, setNotes, searchText, selectedNoteNames
|
|||||||
fetchNotes();
|
fetchNotes();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// useEffect(() => {
|
|
||||||
// const lowerSearch = searchText?.toLowerCase() || "";
|
|
||||||
|
|
||||||
// const filtered = allNotes.filter((noteItem) => {
|
|
||||||
// const plainNote = noteItem?.note?.replace(/<[^>]+>/g, "").toLowerCase();
|
|
||||||
// const fullName = `${noteItem?.createdBy?.firstName || ""} ${noteItem?.createdBy?.lastName || ""}`.trim(); // Get full name
|
|
||||||
// const lowerFullName = fullName.toLowerCase(); // Convert to lowercase for comparison
|
|
||||||
// const createdDate = new Date(noteItem?.createdAt).toLocaleDateString("en-IN").toLowerCase();
|
|
||||||
|
|
||||||
// const matchesSearch =
|
|
||||||
// plainNote.includes(lowerSearch) ||
|
|
||||||
// lowerFullName.includes(lowerSearch) ||
|
|
||||||
// createdDate.includes(lowerSearch);
|
|
||||||
|
|
||||||
// // ✅ Filter logic for multiple selected names
|
|
||||||
// const matchesNameFilter =
|
|
||||||
// selectedNoteNames.length === 0 || // If no names are selected, all notes pass this filter
|
|
||||||
// selectedNoteNames.includes(fullName); // Check if the note's creator is in the selected names array
|
|
||||||
|
|
||||||
// return matchesSearch && matchesNameFilter;
|
|
||||||
// });
|
|
||||||
|
|
||||||
// setFilteredNotes(filtered);
|
|
||||||
// setNotes(filtered);
|
|
||||||
// setCurrentPage(1);
|
|
||||||
// setTotalPages(Math.ceil(filtered.length / pageSize));
|
|
||||||
// }, [searchText, allNotes, selectedNoteNames]); // ✅ Add selectedNoteNames to dependencies
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const lowerSearch = searchText?.toLowerCase() || "";
|
const lowerSearch = searchText?.toLowerCase() || "";
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user