fix: Notification is shown to the user when api for login is not successfull (#361)

This commit is contained in:
pal-sig 2021-11-17 17:00:14 +05:30 committed by GitHub
parent 36e95332bc
commit 865e487fc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 (
<div>
{Element}
<Container direction="vertical">
<Title>Create your account</Title>
<Typography>