From 865e487fc35ea3bbd895e6ab43ed8cbbb17bd78b Mon Sep 17 00:00:00 2001 From: pal-sig <88981777+pal-sig@users.noreply.github.com> Date: Wed, 17 Nov 2021 17:00:14 +0530 Subject: [PATCH] fix: Notification is shown to the user when api for login is not successfull (#361) --- frontend/src/pages/SignUp/index.tsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/frontend/src/pages/SignUp/index.tsx b/frontend/src/pages/SignUp/index.tsx index e451850aad..999f02bede 100644 --- a/frontend/src/pages/SignUp/index.tsx +++ b/frontend/src/pages/SignUp/index.tsx @@ -1,4 +1,4 @@ -import { Button, Input, Typography } from 'antd'; +import { Button, Input, notification, Typography } from 'antd'; import signup from 'api/user/signup'; import ROUTES from 'constants/routes'; import history from 'lib/history'; @@ -18,6 +18,8 @@ import { } from './styles'; const Signup = ({ loggedIn }: SignupProps): JSX.Element => { + const [notificationsInstance, Element] = notification.useNotification(); + const [state, setState] = useState({ submitted: false }); const [formState, setFormState] = useState({ firstName: { value: '' }, @@ -61,17 +63,22 @@ const Signup = ({ loggedIn }: SignupProps): JSX.Element => { loggedIn(); history.push(ROUTES.APPLICATION); } else { - // @TODO throw a error notification here + notificationsInstance.error({ + message: 'Something went wrong', + }); } } catch (error) { - console.error(error); - // @TODO throw a error notification here + notificationsInstance.error({ + message: 'Something went wrong', + }); } })(); }; return (
+ {Element} + Create your account