changed timeout duration

This commit was merged in pull request #436.
This commit is contained in:
victorAnumudu
2023-10-09 11:29:11 +01:00
parent b186549b8d
commit c4af2dfcc8
+4 -3
View File
@@ -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 !== "") {