From 3dd901a81fd80eba6750013ecf99ae1626240f13 Mon Sep 17 00:00:00 2001
From: Pramod Mahajan
Date: Wed, 28 May 2025 19:06:51 +0530
Subject: [PATCH] modified not url
---
src/components/Directory/NotesDirectory.jsx | 75 ++++++++++++---------
src/repositories/DirectoryRepository.jsx | 2 +-
2 files changed, 44 insertions(+), 33 deletions(-)
diff --git a/src/components/Directory/NotesDirectory.jsx b/src/components/Directory/NotesDirectory.jsx
index 5a3c38a4..1c94d9d6 100644
--- a/src/components/Directory/NotesDirectory.jsx
+++ b/src/components/Directory/NotesDirectory.jsx
@@ -10,18 +10,16 @@ import moment from "moment";
import { cacheData, getCachedData } from "../../slices/apiDataManager";
import NoteCardDirectory from "./NoteCardDirectory";
import showToast from "../../services/toastService";
-import {useContactNotes} from "../../hooks/useDirectory";
+import { useContactNotes } from "../../hooks/useDirectory";
const schema = z.object({
note: z.string().min(1, { message: "Note is required" }),
});
-const NotesDirectory = ( {isLoading, contactProfile, setProfileContact} ) =>
-{
- const [ IsActive, setIsActive ] = useState( true )
- const {contactNotes} = useContactNotes(contactProfile?.id,!IsActive)
+const NotesDirectory = ({ isLoading, contactProfile, setProfileContact }) => {
+ const [IsActive, setIsActive] = useState(true);
+ const { contactNotes } = useContactNotes(contactProfile?.id, !IsActive);
-
const [NotesData, setNotesData] = useState();
const [IsSubmitting, setIsSubmitting] = useState(false);
const [addNote, setAddNote] = useState(false);
@@ -72,8 +70,8 @@ const NotesDirectory = ( {isLoading, contactProfile, setProfileContact} ) =>
setValue("note", "");
setIsSubmitting(false);
showToast("Note added successfully!", "success");
- setAddNote( false );
- setIsActive(true)
+ setAddNote(false);
+ setIsActive(true);
} catch (error) {
setIsSubmitting(false);
const msg =
@@ -93,31 +91,35 @@ const NotesDirectory = ( {isLoading, contactProfile, setProfileContact} ) =>
{addNote && (
)}
+ ))}
+ {IsActive && (
+
+ {!isLoading && contactProfile?.notes.length == 0 && !addNote && (
+
No Notes Found
+ )}
+
+ )}
{!IsActive && (
- {!isLoading && contactNotes.length == 0 && !addNote && (
No Notes Found
) }
-
+
+ {!isLoading && contactNotes.length == 0 && !addNote && (
+
No Notes Found
+ )}
+
)}
diff --git a/src/repositories/DirectoryRepository.jsx b/src/repositories/DirectoryRepository.jsx
index 7d614aca..c123cf82 100644
--- a/src/repositories/DirectoryRepository.jsx
+++ b/src/repositories/DirectoryRepository.jsx
@@ -17,7 +17,7 @@ export const DirectoryRepository = {
GetContactProfile: ( id ) => api.get( `/api/directory/profile/${ id }` ),
CreateNote: ( data ) => api.post( '/api/directory/note', data ),
- GetNote: ( id,isActive ) => api.get( `/api/directory/note/${ id }?active=${isActive}` ),
+ GetNote: ( id,isActive ) => api.get( `/api/directory/notes/${ id }?active=${isActive}` ),
UpdateNote: ( id, data ) => api.put( `/api/directory/note/${ id }`, data ),
DeleteNote:(id)=> api.delete(`/api/directory/note/${ id }`)
}
\ No newline at end of file