diff --git a/src/Components/Note/NoteMapper/NoteMapper.tsx b/src/Components/Note/NoteMapper/NoteMapper.tsx index faf2484..5a40a33 100644 --- a/src/Components/Note/NoteMapper/NoteMapper.tsx +++ b/src/Components/Note/NoteMapper/NoteMapper.tsx @@ -8,13 +8,14 @@ import axios from "axios"; export default function NoteMapper() { const navigate = useNavigate(); - const [notes, setNotes] = useState([{ title: "", content: "" }]); + const [notes, setNotes] = useState([]); const [error, setError] = useState(false); const [errormessage, seterrormessage] = useState(""); useEffect(() => { axios .get("http://localhost:8000/notes/") .then((res) => { + console.log("Server Response", res.data); setNotes(res.data); }) .catch((err) => { @@ -50,6 +51,7 @@ export default function NoteMapper() { return ( <> {notes.map((note: { title: string; content: string }, i) => { + console.log(note); return ; })} diff --git a/src/Routes/NewNote/NewNote.tsx b/src/Routes/NewNote/NewNote.tsx index 45e85fd..fff89df 100644 --- a/src/Routes/NewNote/NewNote.tsx +++ b/src/Routes/NewNote/NewNote.tsx @@ -44,7 +44,7 @@ export default function NewNote() { variant="contained" onClick={async () => { axios.post("http://localhost:8000/notes/", { - title: note.content, + title: note.title, content: note.content, }); console.log("foo");