尝试在 hilla(vaadin) 中创建一个应用程序,它将列出产品及其详细信息。为了对产品进行分类,需要存储与类别相关的信息,但在尝试在 hilla/vaadin 网格中列出类别时面临的问题。从端点返回类别列表,并在商店中消耗该列表并尝试在网格中显示。尝试运行应用程序时出现错误“
Type 'Promise<void>' is missing the following properties from type
Run Code Online (Sandbox Code Playgroud)
”
@Nonnull 是在列表的响应中指定的,并且在方法中仍然出现错误
下面是端点类
@Endpoint
@AnonymousAllowed
public class ProductEndpoint {
private InterProductService productService;
@Autowired
public ProductEndpoint(InterProductService productService) {
this.productService = productService;
}
public List<ProductDataList> fetchAllProducts() {
return this.productService.fetchProducts("");
}
public @Nonnull List<@Nonnull ProductCategoryDataList> fetchAllProdCategory() {
return this.productService.fetchProductCategory("");
}
@Nonnull
public EndpointResponse saveCatgeory(@Nonnull CategoryDetails categoryDetails) {
return this.productService.saveCategory(categoryDetails);
}
}
Run Code Online (Sandbox Code Playgroud)
下面是商店
export class ProductStore {
constructor() {
makeAutoObservable(
this);
this.fetchProductCatgeory();
}
async saveProductCategory(prodCategory: CategoryDetails) {
const responseData …Run Code Online (Sandbox Code Playgroud)