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