Hello everyone,
I’m new to Hilla and I was learning about Login Forms when I came to this error,
ERROR(TypeScript) 'LoginForm' refers to a value, but is being used as a type here. Did you mean 'typeof LoginForm'?
Here is the code,
import {ViewConfig} from "@vaadin/hilla-file-router/types.js";
import {LoginForm} from "@vaadin/react-components/LoginForm";
import { Notification } from '@vaadin/react-components/Notification.js';
import {AuthService} from "Frontend/generated/endpoints";
import {createRef} from "react";
export const config: ViewConfig = {
menu:
{
order: 1,
icon: 'line-awesome/svg/download-solid.svg',
},
title: "Login Page"
};
let loginFormRef = createRef<LoginForm>();
async function sendLogin(event: CustomEvent<{ username: string, password: string }>) {
let serverResponse: string;
try {
serverResponse = await AuthService.tryLogIn(event.detail.username, event.detail.password);
} catch {
serverResponse = "Please enter your credentials.";
}
Notification.show(serverResponse, {position: 'bottom-center'});
if (loginFormRef.current)
loginFormRef.current.disabled = false;
};
export default function LoginView()
{
return (
<div className="flex flex-col h-full items-center justify-center p-l text-center box-border">
<LoginForm ref={loginFormRef} onLogin={sendLogin} />
</div>
);
};
Also assist me on where can I find a decent guide to learm Hilla.
Thanks.