File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
web/src/routes/auth/register Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 1313 let password = $state (' ' );
1414 let confirmPassword = $state (' ' );
1515 let name = $state (' ' );
16+ let loading = $state (false );
1617 let errorMessage = $derived (
1718 password === confirmPassword || confirmPassword .length === 0 ? ' ' : $t (' password_does_not_match' ),
1819 );
2728 const onSubmit = async (event : Event ) => {
2829 event .preventDefault ();
2930
30- if (! valid ) {
31+ if (! valid || loading ) {
3132 return ;
3233 }
3334
35+ loading = true ;
3436 errorMessage = ' ' ;
3537
3638 try {
4042 } catch (error ) {
4143 handleError (error , $t (' errors.unable_to_create_admin_account' ));
4244 errorMessage = $t (' errors.unable_to_create_admin_account' );
45+ } finally {
46+ loading = false ;
4347 }
4448 };
4549 </script >
7074 <Alert color ="danger" title ={errorMessage } size =" medium" class =" mt-4" />
7175 {/if }
7276
73- <Button class ="mt-4" type ="submit" size ="giant" shape ="round" fullWidth disabled ={! valid }>{$t (' sign_up' )}</Button >
77+ <Button class ="mt-4" type ="submit" size ="giant" shape ="round" fullWidth disabled ={! valid || loading } {loading }
78+ >{$t (' sign_up' )}</Button
79+ >
7480 </form >
7581</AuthPageLayout >
You can’t perform that action at this time.
0 commit comments