Made note mapping use a common interface

This commit is contained in:
keannu125 2023-03-04 17:21:00 +08:00
parent e6b07438d4
commit 0f18c0be9e

View file

@ -6,7 +6,7 @@ import { Button } from "@mui/material";
import { useQuery } from "react-query";
import { GetNotes } from "../Api/Api";
import { useSelector } from "react-redux";
import { LoginState } from "../../Interfaces/Interfaces";
import { LoginState, NoteProps } from "../../Interfaces/Interfaces";
export default function Notes() {
const navigate = useNavigate();
@ -55,17 +55,7 @@ export default function Notes() {
return (
<>
{notes.map(
(
note: {
owner: string;
title: string;
content: string;
id: number;
date_created: Date;
},
index: number
) => {
{notes.map((note: NoteProps, index: number) => {
return (
<Note
id={note.id}
@ -76,8 +66,7 @@ export default function Notes() {
owner={note.owner}
/>
);
}
)}
})}
<Button
style={styles.button_green}
variant="contained"