Added some fixes

This commit was merged in pull request #345.
This commit is contained in:
2023-07-23 00:12:26 +01:00
parent 0489be5e69
commit 22a45ac15e
4 changed files with 134 additions and 20 deletions
+21
View File
@@ -0,0 +1,21 @@
const checkAndSetError = (field, value, setErrorFunc, errorMessage) => {
const isNotEmpty = () => {
if (!value) {
setErrorFunc({ [field]: errorMessage });
setTimeout(() => setErrorFunc({ [field]: "" }), 1000);
return false;
}
};
const textCount = () => {
if (!value) {
setErrorFunc({ [field]: errorMessage });
setTimeout(() => setErrorFunc({ [field]: "" }), 1000);
return false;
}
};
return { isNotEmpty, textCount };
};
export default checkAndSetError;
+9 -1
View File
@@ -1,5 +1,13 @@
import ClearCookies from "./ClearCookies";
import checkAndSetError from "./checkAndSetError";
import formattedDate from "./fomattedDate";
import getTimeAgo from "./getTimeAgo";
import localImgLoad from "./localImgLoad";
export {ClearCookies, getTimeAgo, localImgLoad}
export {
ClearCookies,
checkAndSetError,
formattedDate,
getTimeAgo,
localImgLoad,
};