handle change data and update data in dashboard page for all tabs
This commit is contained in:
@@ -3,7 +3,7 @@ import TextLoading from "@/app/component/loading/Text";
|
||||
import { TableCell, TableRow } from "@mui/material";
|
||||
import ModalEditItem from "@/components/dashboard/userAccount/components/modal/ModalEditItem";
|
||||
import Content from "./modal/Content";
|
||||
import { useState } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
function ItemRelatives({ row, idx, changeData }) {
|
||||
const contentData = {
|
||||
@@ -12,9 +12,19 @@ function ItemRelatives({ row, idx, changeData }) {
|
||||
phone: row.contact.phone,
|
||||
address: row.contact.address,
|
||||
};
|
||||
|
||||
const [data, setData] = useState(contentData);
|
||||
const resetData = () => setData(contentData);
|
||||
|
||||
useEffect(() => {
|
||||
setData({
|
||||
name: row.name,
|
||||
relation: row.relation,
|
||||
phone: row.contact.phone,
|
||||
address: row.contact.address,
|
||||
});
|
||||
}, [row]);
|
||||
|
||||
return (
|
||||
<TableRow
|
||||
key={idx}
|
||||
|
||||
Reference in New Issue
Block a user