From e4961cd3650fe91fb26d58f96a1a901179a4b70b Mon Sep 17 00:00:00 2001 From: Narutsky-Amosov Mikhail Date: Sun, 9 Apr 2023 01:56:41 +0300 Subject: [PATCH] fix responce Fixed validation error if Email has an incorrect look and a warning about incorrect Email input --- public/javascripts/expressCart.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/public/javascripts/expressCart.js b/public/javascripts/expressCart.js index 66412d3c..589e69ad 100644 --- a/public/javascripts/expressCart.js +++ b/public/javascripts/expressCart.js @@ -185,7 +185,12 @@ $(document).ready(function (){ window.location = '/checkout/shipping'; }) .fail(function(msg){ - showNotification(msg.responseJSON.message, 'danger'); + const errData = JSON.parse(msg.responseText); + if (errData[0].message == 'should match format \"emailAddress\"') { + showNotification('Email filled out incorrectly', 'danger'); + } else { + showNotification(msg.responseJSON.message, 'danger'); + } }); } });