31 lines
632 B
JavaScript
31 lines
632 B
JavaScript
import { Button } from "@mui/material";
|
|
import { useState } from "react";
|
|
|
|
function ButtonApply({ sendReq, setOpen }) {
|
|
const [loading, setLoading] = useState(false);
|
|
|
|
const handleClick = () => {
|
|
setLoading(true);
|
|
|
|
sendReq().finally(() => {
|
|
setOpen(false);
|
|
setLoading(false);
|
|
});
|
|
};
|
|
|
|
return (
|
|
<div className="flex justify-end w-full">
|
|
<Button
|
|
loading={loading}
|
|
variant="contained"
|
|
onClick={handleClick}
|
|
className="!px-3 !py-2 !text-[16px] !font-medium"
|
|
>
|
|
اعمال تغییرات
|
|
</Button>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default ButtonApply;
|