From 9b3c14c2cbdc0a5e255c98d9ff958eeccba2bef2 Mon Sep 17 00:00:00 2001 From: phegalante Date: Fri, 23 Oct 2020 16:51:08 -0300 Subject: [PATCH] improvement: accept number with - like 1399142-8988 and sanitize it in backend --- backend/src/controllers/ContactController.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/src/controllers/ContactController.ts b/backend/src/controllers/ContactController.ts index efc1c4f..9f42a1c 100644 --- a/backend/src/controllers/ContactController.ts +++ b/backend/src/controllers/ContactController.ts @@ -41,6 +41,7 @@ export const index = async (req: Request, res: Response): Promise => { export const store = async (req: Request, res: Response): Promise => { const newContact: ContactData = req.body; + newContact.number = newContact.number.replace("-", "").replace(" ", ""); const schema = Yup.object().shape({ name: Yup.string().required(),