fixed website breaking the server
This commit is contained in:
@@ -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 onSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
|
||||||
const editing = profile ? true : false;
|
const editing = profile ? true : false;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const form = new FormData();
|
const form = new FormData(e.currentTarget);
|
||||||
const status = form.get("status") as string;
|
const status = form.get("status") as string;
|
||||||
if (facebook?.length > 100) {
|
if (facebook?.length > 100) {
|
||||||
dispatch(createAlert("Facebook link is longer 100 characters", "danger"));
|
dispatch(createAlert("Facebook link is longer 100 characters", "danger"));
|
||||||
@@ -113,7 +113,7 @@ const ProfileForm = () => {
|
|||||||
dispatch(createAlert("Skills is required", "danger"));
|
dispatch(createAlert("Skills is required", "danger"));
|
||||||
} else if (status?.length === 0) {
|
} else if (status?.length === 0) {
|
||||||
dispatch(createAlert("Status is required", "danger"));
|
dispatch(createAlert("Status is required", "danger"));
|
||||||
} else if (location?.length === 0) {
|
} else if (location?.length > 100) {
|
||||||
dispatch(createAlert("Location is longer 100 characters", "danger"));
|
dispatch(createAlert("Location is longer 100 characters", "danger"));
|
||||||
} else if (githubusername?.length > 50) {
|
} else if (githubusername?.length > 50) {
|
||||||
dispatch(
|
dispatch(
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ router.post(
|
|||||||
auth,
|
auth,
|
||||||
check("status", "Status is required").notEmpty(),
|
check("status", "Status is required").notEmpty(),
|
||||||
check("skills", "Skills is required").notEmpty(),
|
check("skills", "Skills is required").notEmpty(),
|
||||||
|
check("website", "Not a valid website").isURL(),
|
||||||
async (req, res) => {
|
async (req, res) => {
|
||||||
const errors = validationResult(req);
|
const errors = validationResult(req);
|
||||||
if (!errors.isEmpty()) {
|
if (!errors.isEmpty()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user