mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-14 04:15:57 +08:00
fix: Notification is shown to the user when api for login is not successfull (#361)
This commit is contained in:
parent
36e95332bc
commit
865e487fc3
@ -1,4 +1,4 @@
|
|||||||
import { Button, Input, Typography } from 'antd';
|
import { Button, Input, notification, Typography } from 'antd';
|
||||||
import signup from 'api/user/signup';
|
import signup from 'api/user/signup';
|
||||||
import ROUTES from 'constants/routes';
|
import ROUTES from 'constants/routes';
|
||||||
import history from 'lib/history';
|
import history from 'lib/history';
|
||||||
@ -18,6 +18,8 @@ import {
|
|||||||
} from './styles';
|
} from './styles';
|
||||||
|
|
||||||
const Signup = ({ loggedIn }: SignupProps): JSX.Element => {
|
const Signup = ({ loggedIn }: SignupProps): JSX.Element => {
|
||||||
|
const [notificationsInstance, Element] = notification.useNotification();
|
||||||
|
|
||||||
const [state, setState] = useState({ submitted: false });
|
const [state, setState] = useState({ submitted: false });
|
||||||
const [formState, setFormState] = useState({
|
const [formState, setFormState] = useState({
|
||||||
firstName: { value: '' },
|
firstName: { value: '' },
|
||||||
@ -61,17 +63,22 @@ const Signup = ({ loggedIn }: SignupProps): JSX.Element => {
|
|||||||
loggedIn();
|
loggedIn();
|
||||||
history.push(ROUTES.APPLICATION);
|
history.push(ROUTES.APPLICATION);
|
||||||
} else {
|
} else {
|
||||||
// @TODO throw a error notification here
|
notificationsInstance.error({
|
||||||
|
message: 'Something went wrong',
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
notificationsInstance.error({
|
||||||
// @TODO throw a error notification here
|
message: 'Something went wrong',
|
||||||
|
});
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
{Element}
|
||||||
|
|
||||||
<Container direction="vertical">
|
<Container direction="vertical">
|
||||||
<Title>Create your account</Title>
|
<Title>Create your account</Title>
|
||||||
<Typography>
|
<Typography>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user