feat: Improve login event handling and form data validation in dees-simple-login component
This commit is contained in:
@@ -19,7 +19,13 @@ export const demoFunc = () => html`
|
||||
name="My Application"
|
||||
@login=${(e: CustomEvent) => {
|
||||
console.log('Login event received:', e.detail);
|
||||
alert(`Login attempted with:\nUsername: ${e.detail.formData.username}\nPassword: ${e.detail.formData.password}`);
|
||||
const loginData = e.detail?.data || e.detail;
|
||||
if (loginData?.username && loginData?.password) {
|
||||
alert(`Login attempted with:\nUsername: ${loginData.username}\nPassword: ${loginData.password}`);
|
||||
// Here you would typically validate credentials and show the slotted content
|
||||
} else {
|
||||
console.error('Invalid login data structure:', e.detail);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div style="padding: 40px; text-align: center;">
|
||||
|
||||
Reference in New Issue
Block a user