@@ -13,7 +13,6 @@ import {
1313import { ChevronRightIcon } from "lucide-react" ;
1414import React , { useEffect , useState } from "react" ;
1515import { Controller , useForm } from "react-hook-form" ;
16- import { useHistory , useParams } from "react-router-dom" ;
1716import { PencilIcon } from "../../../assets/icons" ;
1817import Button from "../../../components/common/Button" ;
1918import ColourStarIcon from "../../../components/common/ColourStarIcon" ;
@@ -85,7 +84,6 @@ const validateDate = (month: string, date: string, year: string) => {
8584} ;
8685
8786const AddPetForm = ( ) : React . ReactElement => {
88- const history = useHistory ( ) ;
8987 const toast = useToast ( ) ;
9088 const [ localProfilePhoto , setLocalProfilePhoto ] = useState <
9189 string | undefined
@@ -115,7 +113,6 @@ const AddPetForm = (): React.ReactElement => {
115113 handleSubmit,
116114 setValue,
117115 getValues,
118- reset,
119116 formState : { errors } ,
120117 } = useForm < FormData > ( {
121118 defaultValues : {
@@ -208,11 +205,13 @@ const AddPetForm = (): React.ReactElement => {
208205 if ( ! files || files . length === 0 ) return ;
209206 const file = files [ 0 ] ;
210207 const reader = new FileReader ( ) ;
208+ setIsUploading ( true ) ;
211209 reader . onloadend = ( ) => {
212210 setLocalProfilePhoto ( reader . result as string ) ;
213211 setValue ( "profilePhoto" , reader . result as string , {
214212 shouldValidate : true ,
215213 } ) ;
214+ setIsUploading ( false ) ;
216215 } ;
217216 reader . readAsDataURL ( file ) ;
218217 } ;
@@ -675,7 +674,7 @@ const AddPetForm = (): React.ReactElement => {
675674 // add implementation here
676675 } }
677676 handleSecondaryButtonClick = { closeAddPetModal }
678- > </ AddPetModal >
677+ / >
679678 </ >
680679 ) ;
681680} ;
0 commit comments