File tree Expand file tree Collapse file tree
src/routes/(authenticated)/admin/users Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717
1818 let username = $state <string >(' ' );
1919 let usernameValid = $state (true );
20- let usernameReady = $derived (usernameValid && username .length > 0 && username != user .name );
20+ let usernameSet = $derived (username .length > 0 && username != user .name );
2121 let email = $state <string >(' ' );
2222 let emailValid = $state (true );
23- let emailReady = $derived (emailValid && email .length > 0 && email != user .email );
23+ let emailSet = $derived (email .length > 0 && email != user .email );
2424
2525 function sendit() {
2626 adminApi
2727 .adminModifyUser (user .id , {
28- name: usernameReady ? username : null ,
29- email: emailReady ? email : null ,
28+ name: usernameSet ? username : null ,
29+ email: emailSet ? email : null ,
3030 })
3131 .then (() => (open = false ))
3232 .catch (handleApiError );
5353 {/each }
5454 </div >
5555 </div >
56- <Button onclick ={sendit } disabled ={usernameReady && emailReady }>Apply</Button >
56+ <Button
57+ onclick ={sendit }
58+ disabled ={(usernameSet && ! usernameValid ) ||
59+ (emailSet && ! emailValid ) ||
60+ (! usernameSet && ! emailSet )}
61+ >
62+ Apply
63+ </Button >
5764 </Dialog .Content >
5865</Dialog .Root >
You can’t perform that action at this time.
0 commit comments