React front end - execute service

Hi guys,

I have installed the React front-end into my project. I am very new to React…

There does not seem to be any documentation on how to execute a service. Would someone be able to share a code snippet of adding say a button to the homepage that activates a service.

e.g. from my services.ts file

Have a button that runs this:

import { CubaApp, FetchOptions } from "@cuba-platform/rest";

export type billing_AccountService_getBalanceForAccount_params = {
  account: any;
};

export var restServices = {
  billing_AccountService: {
getBalanceForAccount: (cubaApp: CubaApp, fetchOpts?: FetchOptions) => (
  params: billing_AccountService_getBalanceForAccount_params
) => {
  return cubaApp.invokeService(
    "billing_AccountService",
    "getBalanceForAccount",
    params,
    fetchOpts
  );
}
  }
};

Hi,
There is a PetClinic React demo:
https://demo10.cuba-platform.com/petclinic-front/index.html#/

On the Visits browser you can click a Generate Test Data button, and it calls a CUBA service.

The source code is here: cuba-petclinic-online-demo/PetclinicVisitBrowser.tsx at master · cuba-guides/cuba-petclinic-online-demo · GitHub