mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-14 06:26:03 +08:00
Bug(UI): Signup onclick loading (#541)
* bug(UI): on click loader is added * bug(UI): on click loader is added
This commit is contained in:
parent
d825fc2f30
commit
7f5b0c15c7
@ -20,13 +20,11 @@ import {
|
|||||||
const Signup = ({ loggedIn }: SignupProps): JSX.Element => {
|
const Signup = ({ loggedIn }: SignupProps): JSX.Element => {
|
||||||
const [notificationsInstance, Element] = notification.useNotification();
|
const [notificationsInstance, Element] = notification.useNotification();
|
||||||
|
|
||||||
const [state, setState] = useState({ submitted: false });
|
const [loading, setLoading] = useState(false);
|
||||||
|
|
||||||
const [formState, setFormState] = useState({
|
const [formState, setFormState] = useState({
|
||||||
firstName: { value: '' },
|
firstName: { value: '' },
|
||||||
companyName: { value: '' },
|
|
||||||
email: { value: '' },
|
email: { value: '' },
|
||||||
password: { value: '', valid: true },
|
|
||||||
emailOptIn: { value: true },
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const updateForm = (
|
const updateForm = (
|
||||||
@ -50,7 +48,7 @@ const Signup = ({ loggedIn }: SignupProps): JSX.Element => {
|
|||||||
(async (): Promise<void> => {
|
(async (): Promise<void> => {
|
||||||
try {
|
try {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
setState((state) => ({ ...state, submitted: true }));
|
setLoading(true);
|
||||||
const payload = {
|
const payload = {
|
||||||
first_name: formState.firstName,
|
first_name: formState.firstName,
|
||||||
email: formState.email,
|
email: formState.email,
|
||||||
@ -69,10 +67,12 @@ const Signup = ({ loggedIn }: SignupProps): JSX.Element => {
|
|||||||
message: 'Something went wrong',
|
message: 'Something went wrong',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
setLoading(false);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
notificationsInstance.error({
|
notificationsInstance.error({
|
||||||
message: 'Something went wrong',
|
message: 'Something went wrong',
|
||||||
});
|
});
|
||||||
|
setLoading(false);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
};
|
};
|
||||||
@ -121,7 +121,8 @@ const Signup = ({ loggedIn }: SignupProps): JSX.Element => {
|
|||||||
type="primary"
|
type="primary"
|
||||||
htmlType="submit"
|
htmlType="submit"
|
||||||
data-attr="signup"
|
data-attr="signup"
|
||||||
disabled={state.submitted && !formState.password}
|
loading={loading}
|
||||||
|
disabled={loading || !formState.email.value}
|
||||||
>
|
>
|
||||||
Get Started
|
Get Started
|
||||||
</Button>
|
</Button>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user