I have added Hilla to an existing project primarily used as an API for others to use.
I created a service:
@BrowserCallable
class DbService(
val itemDao: DbItemDao,
) {
@AnonymousAllowed
fun getFullItem(id: String): Item {
return itemDao.findById(UUID.fromString(id)).get()
}
}
My generated endpoint looks like this:
async function getFullItem_1(id: string | undefined, init?: EndpointRequestInit_1): Promise<Item_1 | undefined> { return client_1.call("DbService", "getFullItem", { id }, init); }
I create this in my view to fetch my item (hardcoded UUID just for testing)
import {DbService} from 'Frontend/generated/endpoints';
export default function MainView() {
useEffect(() => {
DbService.getFullItem("7089ba52-9e16-49a1-bb9c-58143ab0d580").then(console.log);
}, []);
return(/* stuff */)
}
But my browser reports the following error in the console:
Uncaught (in promise) Error: Incorrect number of parameters for endpoint 'DbService' method 'getFullItem', expected: 1, got: 0
What am i doing wrong here?