From c4af2dfcc8a2d53f66c441d198516ea219c6fbfe Mon Sep 17 00:00:00 2001 From: victorAnumudu Date: Mon, 9 Oct 2023 11:29:11 +0100 Subject: [PATCH] changed timeout duration --- src/components/Settings/index.jsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/Settings/index.jsx b/src/components/Settings/index.jsx index 161d216..3038f7e 100644 --- a/src/components/Settings/index.jsx +++ b/src/components/Settings/index.jsx @@ -29,6 +29,7 @@ export default function Settings({ faq }) { const [profileImg, setProfileImg] = useState( userDetails?.profile_pic_url ? userDetails.profile_pic_url : profile ); + let [uploadStatus, setUploadStatus] = useState({loading: false, status: false, message:''}) // HOLDS STATE FOR UPLOAD PROFILE PICTURE STATUS const [coverImg, setCoverImg] = useState(cover); const [reloadCardList, setReloadCardList] = useState(false); // STATE TO DETERMINE WHEN CARD LIST RELOADS. EG: WHEN USER DELETES A CARD @@ -37,7 +38,6 @@ export default function Settings({ faq }) { const browseProfileImg = () => { profileImgInput.current.click(); }; -let [uploadStatus, setUploadStatus] = useState({loading: false, status: false, message:''}) const profileImgChangHandler = (e) => { // if (e.target.value !== "") { // const imgReader = new FileReader(); @@ -46,6 +46,7 @@ let [uploadStatus, setUploadStatus] = useState({loading: false, status: false, m // }; // imgReader.readAsDataURL(e.target.files[0]); // } + setUploadStatus({loading: false, status: false, message:''}) let acceptedFormat = ["jpeg", "jpg", "png", "bmp", "gif"] // ARRAY OF SUPPORTED FORMATS let uploadedFile = e.target.files[0] //UPLOADED FILE @@ -62,7 +63,7 @@ let [uploadStatus, setUploadStatus] = useState({loading: false, status: false, m return setTimeout(()=>{ profileImgInput.current.value = '' // clear the input setUploadStatus({loading: false, status: false, message:''}) - },3000) + },5000) } if(uploadedFile.size > 5*1048576){ // CHECKING FOR CORRECT FILE SIZE @@ -70,7 +71,7 @@ let [uploadStatus, setUploadStatus] = useState({loading: false, status: false, m return setTimeout(()=>{ profileImgInput.current.value = '' // clear the input setUploadStatus({loading: false, status: false, message:''}) - },3000) + },5000) } if (e.target.value !== "") {