fixed website breaking the server

This commit is contained in:
QkoSad
2024-09-28 20:16:02 +03:00
parent 46f6280152
commit bcbffad32d
3 changed files with 3 additions and 7 deletions
-5
View File
@@ -1,6 +1 @@
1. When creating profile in the Profile form need to be added validation for the
email because if the email is not email it gets sent to the server and crashes
Fix all the form data apis, formData
Extract the inpudate component from addeducation
maybe fix that addeducation
@@ -93,7 +93,7 @@ const ProfileForm = () => {
const onSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
const editing = profile ? true : false;
e.preventDefault();
const form = new FormData();
const form = new FormData(e.currentTarget);
const status = form.get("status") as string;
if (facebook?.length > 100) {
dispatch(createAlert("Facebook link is longer 100 characters", "danger"));
@@ -113,7 +113,7 @@ const ProfileForm = () => {
dispatch(createAlert("Skills is required", "danger"));
} else if (status?.length === 0) {
dispatch(createAlert("Status is required", "danger"));
} else if (location?.length === 0) {
} else if (location?.length > 100) {
dispatch(createAlert("Location is longer 100 characters", "danger"));
} else if (githubusername?.length > 50) {
dispatch(
+1
View File
@@ -47,6 +47,7 @@ router.post(
auth,
check("status", "Status is required").notEmpty(),
check("skills", "Skills is required").notEmpty(),
check("website", "Not a valid website").isURL(),
async (req, res) => {
const errors = validationResult(req);
if (!errors.isEmpty()) {