improvement: accept number with - like 1399142-8988 and sanitize it in backend

This commit is contained in:
phegalante
2020-10-23 16:51:08 -03:00
parent d82b65f879
commit 9b3c14c2cb

View File

@@ -41,6 +41,7 @@ export const index = async (req: Request, res: Response): Promise<Response> => {
export const store = async (req: Request, res: Response): Promise<Response> => { export const store = async (req: Request, res: Response): Promise<Response> => {
const newContact: ContactData = req.body; const newContact: ContactData = req.body;
newContact.number = newContact.number.replace("-", "").replace(" ", "");
const schema = Yup.object().shape({ const schema = Yup.object().shape({
name: Yup.string().required(), name: Yup.string().required(),