Added some fixes
This commit was merged in pull request #345.
This commit is contained in:
@@ -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
@@ -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,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user