page add panel/doctor role agent && save data crop img && upload img && just roles agent can access panel && save data doctor && add field phone number && remove two tab
This commit is contained in:
@@ -1,15 +1,19 @@
|
||||
import { Button } from "@mui/material";
|
||||
import { useState } from "react";
|
||||
import Cropper from "react-easy-crop";
|
||||
import { cropImage } from "./cropImg";
|
||||
import { cropImage, dataURLtoFile } from "./cropImg";
|
||||
|
||||
function Crop({ data, uploadImg, handleClose }) {
|
||||
const [crop, setCrop] = useState({ x: 0, y: 0 });
|
||||
const [zoom, setZoom] = useState(1);
|
||||
const [croppedAreaPixels, setCroppedAreaPixels] = useState(null);
|
||||
|
||||
const onComplete = (imagePromisse) =>
|
||||
imagePromisse.then((image) => uploadImg(image));
|
||||
const onComplete = async (imagePromise) => {
|
||||
const dataUrl = await imagePromise;
|
||||
const file = dataURLtoFile(dataUrl, "cropped-image.jpg");
|
||||
|
||||
uploadImg({ blob: dataUrl, file });
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="mt-[16px]">
|
||||
|
||||
Reference in New Issue
Block a user