fix path bug
This commit is contained in:
parent
ca758e2dfa
commit
200541f74e
@ -1,4 +1,6 @@
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
import useSteps from "../../../hooks/palmistry/use-steps";
|
||||
import Button from "../button/button";
|
||||
import BiometricData from "../biometric-data/biometric-data";
|
||||
import UploadModal from "../upload-modal/upload-modal";
|
||||
@ -14,6 +16,7 @@ type Props = {
|
||||
};
|
||||
|
||||
export default function StepUpload(props: Props) {
|
||||
const steps = useSteps();
|
||||
const api = useApi();
|
||||
const dispatch = useDispatch();
|
||||
|
||||
@ -22,6 +25,7 @@ export default function StepUpload(props: Props) {
|
||||
const [recognitionErrorModalIsOpen, setRecognitionErrorModalIsOpen] =
|
||||
useState(false);
|
||||
const [palmCameraModalIsOpen, setPalmCameraModalIsOpen] = useState(false);
|
||||
const [palmPhoto, setPalmPhoto] = useState<string>();
|
||||
|
||||
// const imitateRequestError = () => {
|
||||
// setTimeout(() => {
|
||||
@ -49,8 +53,9 @@ export default function StepUpload(props: Props) {
|
||||
|
||||
const reader = new FileReader();
|
||||
|
||||
// reader.onloadend = () => {
|
||||
// };
|
||||
reader.onloadend = () => {
|
||||
setPalmPhoto(reader.result as string);
|
||||
};
|
||||
|
||||
reader.readAsDataURL(event.target.files[0]);
|
||||
};
|
||||
@ -73,10 +78,20 @@ export default function StepUpload(props: Props) {
|
||||
const onTakePhoto = async (photo: string) => {
|
||||
const file = DataURIToBlob(photo);
|
||||
await getLines(file);
|
||||
setPalmPhoto(photo as string);
|
||||
setUploadMenuModalIsOpen(false);
|
||||
setPalmCameraModalIsOpen(false);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (palmPhoto) {
|
||||
setIsUpladProcessing(false);
|
||||
steps.saveCurrent(palmPhoto);
|
||||
steps.goNext();
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [palmPhoto]);
|
||||
|
||||
useEffect(() => {
|
||||
if (recognitionErrorModalIsOpen || palmCameraModalIsOpen) {
|
||||
props.onOpenModal(true);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user