From 906063a2a27d1083e58ceaa32a3d7af9bcbd9fcf Mon Sep 17 00:00:00 2001 From: keannu125 Date: Wed, 29 Mar 2023 19:37:17 +0800 Subject: [PATCH] Added logic to support adding and editing of public notes --- src/Components/Note/Note.tsx | 2 ++ src/Components/Notes/Notes.tsx | 5 ++--- src/Interfaces/Interfaces.tsx | 3 +++ src/Routes/NewNote/NewNote.tsx | 14 +++++++++++++- src/Routes/ViewEditNote/ViewEditNote.tsx | 21 +++++++++++++++++---- 5 files changed, 37 insertions(+), 8 deletions(-) diff --git a/src/Components/Note/Note.tsx b/src/Components/Note/Note.tsx index 59003e7..b382b84 100644 --- a/src/Components/Note/Note.tsx +++ b/src/Components/Note/Note.tsx @@ -13,6 +13,7 @@ export default function Note(props: NoteProps) { mutationFn: DeleteNote, onSuccess: () => { queryClient.invalidateQueries("notes"); + queryClient.invalidateQueries("public_notes"); }, }); return ( @@ -30,6 +31,7 @@ export default function Note(props: NoteProps) {

Timestamp: {String(props.date_created)}

+

Public: {props.public ? "Yes" : "No"}

); } - if (data) { + if (data && note) { return (
@@ -80,6 +82,16 @@ export default function ViewNote() { }} />
+
+

Public Note?

+ { + setNote({ ...note, public: !note.public }); + }} + /> +