Chnages in Directory for fetching data.

This commit is contained in:
Kartik sharma 2025-06-26 11:30:07 +05:30
parent 0a6d5746ed
commit d6d0fd9d14

View File

@ -13,7 +13,7 @@ const NotesCardViewDirectory = ({ notes, setNotes, searchText, selectedNoteNames
const fetchNotes = async () => {
setLoading(true);
try {
const response = await DirectoryRepository.GetNotes(20, 1);
const response = await DirectoryRepository.GetNotes(1000, 1);
const fetchedNotes = response.data?.data || [];
setAllNotes(fetchedNotes);
} catch (error) {
@ -27,34 +27,6 @@ const NotesCardViewDirectory = ({ notes, setNotes, searchText, selectedNoteNames
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(() => {
const lowerSearch = searchText?.toLowerCase() || "";