Skip to content
This repository has been archived by the owner on Nov 15, 2024. It is now read-only.

Commit

Permalink
Restyled by prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
restyled-commits committed Jul 23, 2021
1 parent 856f575 commit af9bb95
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 79 deletions.
12 changes: 9 additions & 3 deletions src/pages/private/user/messages/modal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,18 @@ import { apiUrl, endPoints } from '../../../../config.json';
import http from '../../../../services/httpService';
import { NotifyAlert, TimerAlert } from '../../../../components';

const ModalBox = ({ personId, personName, toggleOpen, triggerModal, modalValue }) => {
const ModalBox = ({
personId,
personName,
toggleOpen,
triggerModal,
modalValue,
}) => {
const [ModalValue, setModalValue] = useState(() => modalValue);

useEffect(() => {
setModalValue(modalValue)
}, [modalValue])
setModalValue(modalValue);
}, [modalValue]);

const handleSubmit = () => {
const messageObject = {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/private/user/messages/single.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const UserCard = ({ person, personName, personBio, personImageUrl }) => {
};

const triggerModal = () => {
getUserMessage()
getUserMessage();
setModalOpen(!modalOpen);
};

Expand Down
5 changes: 1 addition & 4 deletions src/pages/private/user/profile/messages.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ const Message = ({ person, message, index }) => {
<>
<div className={getClass()}>
<div className="card-body text-dark">
<h5
className="card-title h5-responsive mb-2"
style={{ fontWeight: 500 }}
>
<h5 className="card-title h5-responsive mb-2" style={{ fontWeight: 500 }}>
{person}
</h5>
<p className="p-responsive" style={{ fontFamily: 'Product Sans' }}>
Expand Down
9 changes: 5 additions & 4 deletions src/services/httpService.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@ import logger from './logService';
// import { TimerAlert } from '../components';

axios.interceptors.response.use(null, (error) => {
const expectedErrors = error.response && error.response.status >= 400 &&
error.response.status < 500;
const expectedErrors =
error.response && error.response.status >= 400 && error.response.status < 500;
if (!expectedErrors) {
logger.log(error);
// TimerAlert('Error', ' An unexpected error occurred', 'error');
}
return Promise.reject(error);
});

const setJwt =
(jwt) => { axios.defaults.headers.common['x-auth-token'] = jwt; };
const setJwt = (jwt) => {
axios.defaults.headers.common['x-auth-token'] = jwt;
};

export default {
get: axios.get,
Expand Down
143 changes: 76 additions & 67 deletions src/utils/schemas.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,88 +2,97 @@ import Joi from 'joi-browser';

const LoginSchema = () => {
return {
userId : Joi.number()
.error(() => {
return {
message : 'Please enter a valid enrollment number',
};
})
.required(),
password : Joi.string()
.error(() => {
return {
message : 'Password cannot be empty',
};
})
.required(),
userId: Joi.number()
.error(() => {
return {
message: 'Please enter a valid enrollment number',
};
})
.required(),
password: Joi.string()
.error(() => {
return {
message: 'Password cannot be empty',
};
})
.required(),
};
};

const SignUpSchema = () => {
return {
name : Joi.string().min(5).label('Name').required(),
password : Joi.string()
.min(7)
.error(() => {
return {
message :
'Password should be at least 7 characters long',
};
})
.required(),
department : Joi.string().min(2).max(3).required(),
section : Joi.string().length(1).required(),
name: Joi.string().min(5).label('Name').required(),
password: Joi.string()
.min(7)
.error(() => {
return {
message: 'Password should be at least 7 characters long',
};
})
.required(),
department: Joi.string().min(2).max(3).required(),
section: Joi.string().length(1).required(),
};
};

const DetailsSchema = () => {
return {
contactEmail :
Joi.string().email().allow('').trim().strict().label('Contact Email'),
facebook : Joi.string().uri().label('Facebook').error(() => {
return {
message : 'Please enter a valid Facebook profile URL',
};
}),
linkedin : Joi.string().uri().label('Linkedin').error(() => {
return {
message : 'Please enter a valid LinkedIn profile URL',
};
}),
whatsappNo : Joi.string()
.length(10)
.regex(/^\d+$/)
.label('WhatsApp Number')
.error(() => {
return {
message : 'Input should be a number of length 10',
};
}),
contactNo : Joi.string()
.label('Contact Number')
.length(10)
.regex(/^\d+$/)
.error(() => {
return {
message : 'Input should be a number of length 10',
};
}),
snapchat : Joi.string().label('Snapchat'),
instagram : Joi.string().label('Instagram'),
contactEmail: Joi.string()
.email()
.allow('')
.trim()
.strict()
.label('Contact Email'),
facebook: Joi.string()
.uri()
.label('Facebook')
.error(() => {
return {
message: 'Please enter a valid Facebook profile URL',
};
}),
linkedin: Joi.string()
.uri()
.label('Linkedin')
.error(() => {
return {
message: 'Please enter a valid LinkedIn profile URL',
};
}),
whatsappNo: Joi.string()
.length(10)
.regex(/^\d+$/)
.label('WhatsApp Number')
.error(() => {
return {
message: 'Input should be a number of length 10',
};
}),
contactNo: Joi.string()
.label('Contact Number')
.length(10)
.regex(/^\d+$/)
.error(() => {
return {
message: 'Input should be a number of length 10',
};
}),
snapchat: Joi.string().label('Snapchat'),
instagram: Joi.string().label('Instagram'),
};
};

const EmailAccess = () => {
return {
email : Joi.string()
.email()
.error(() => {
return {
message : 'Please enter a valid Email',
};
})
.required(),
email: Joi.string()
.email()
.error(() => {
return {
message: 'Please enter a valid Email',
};
})
.required(),
};
};

export {LoginSchema, SignUpSchema, DetailsSchema, EmailAccess};
export { LoginSchema, SignUpSchema, DetailsSchema, EmailAccess };

0 comments on commit af9bb95

Please sign in to comment.