From db1f9100f40d58e24ed798f9cc386d810493e027 Mon Sep 17 00:00:00 2001 From: Mrigaank Sharma Date: Thu, 31 Oct 2024 15:48:13 +0530 Subject: [PATCH] done --- Client/src/pages/FilterNotes.jsx | 6 +++--- Client/src/pages/delete.jsx | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Client/src/pages/FilterNotes.jsx b/Client/src/pages/FilterNotes.jsx index 1803cab..97564ed 100644 --- a/Client/src/pages/FilterNotes.jsx +++ b/Client/src/pages/FilterNotes.jsx @@ -103,17 +103,17 @@ function FilterNotes() { subjectsForYear.map((note) => (
{note.subject} -

+

{note.author}

diff --git a/Client/src/pages/delete.jsx b/Client/src/pages/delete.jsx index 0cbd1e0..1187383 100644 --- a/Client/src/pages/delete.jsx +++ b/Client/src/pages/delete.jsx @@ -55,7 +55,9 @@ const DeleteNote = () => { try { const response = await fetch(`https://scholarstation.onrender.com/notes/${id}`, { method: 'DELETE' }); if (!response.ok) throw new Error("Error deleting note."); - setNotes(notes.filter(note => note.id !== id)); + + // After deletion, update the notes state by filtering out the deleted note + setNotes(prevNotes => prevNotes.filter(note => note.id !== id)); } catch (err) { setError("Error deleting note."); console.error(err);