mirror of
https://github.com/immich-app/immich.git
synced 2025-11-12 09:36:50 -05:00
fix(web): sign up double click (#21349)
This commit is contained in:
parent
76eaee3657
commit
25a94bd117
@ -13,6 +13,7 @@
|
||||
let password = $state('');
|
||||
let confirmPassword = $state('');
|
||||
let name = $state('');
|
||||
let loading = $state(false);
|
||||
let errorMessage = $derived(
|
||||
password === confirmPassword || confirmPassword.length === 0 ? '' : $t('password_does_not_match'),
|
||||
);
|
||||
@ -27,10 +28,11 @@
|
||||
const onSubmit = async (event: Event) => {
|
||||
event.preventDefault();
|
||||
|
||||
if (!valid) {
|
||||
if (!valid || loading) {
|
||||
return;
|
||||
}
|
||||
|
||||
loading = true;
|
||||
errorMessage = '';
|
||||
|
||||
try {
|
||||
@ -40,6 +42,8 @@
|
||||
} catch (error) {
|
||||
handleError(error, $t('errors.unable_to_create_admin_account'));
|
||||
errorMessage = $t('errors.unable_to_create_admin_account');
|
||||
} finally {
|
||||
loading = false;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@ -70,6 +74,8 @@
|
||||
<Alert color="danger" title={errorMessage} size="medium" class="mt-4" />
|
||||
{/if}
|
||||
|
||||
<Button class="mt-4" type="submit" size="giant" shape="round" fullWidth disabled={!valid}>{$t('sign_up')}</Button>
|
||||
<Button class="mt-4" type="submit" size="giant" shape="round" fullWidth disabled={!valid || loading} {loading}
|
||||
>{$t('sign_up')}</Button
|
||||
>
|
||||
</form>
|
||||
</AuthPageLayout>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user