Pomada
A shared FE business logic repository.
Quick start
Install the library:
npm i @holaluz/pomada
Import and execute the use case you need. For example, getting prices of the products of a supply point:
import { getProductPrices, getSupplyPoint } from '@holaluz/pomada'
getSupplyPoint(
{
cups: 'example cups',
},
{
onSuccess(supplyPoint) {
getProductPrices(
{
products: supplyPoint.contractableProducts,
consumption: supplyPoint.consumption,
currentPower: supplyPoint.currentPower,
desiredPower: supplyPoint.optimizedPower,
optimizedPower: supplyPoint.optimizedPower,
},
{
onSuccess(prices) {
console.log(prices)
},
onError(error) {
console.log(error)
},
}
)
},
onCupsAlreadyClient(supplyPoint) {
console.log(supplyPoint)
},
onCupsInvalid(cupsError) {
console.log(cupsError)
},
}
)
For a more in-depth documentation, check the docs.
Usage for staging or production
This library reads a process.env.ENV
variable, and access staging APIs if ENV = staging
or production APIs if ENV = production
.
Development
Use Visual Studio Code. Execute and debug code with its included Typescript debugger (pressing F5).
Documentation is generated automatically for every use case and models inside src
. Check out Typedoc for the available options.
Links
Documentation.
Npm Package.
Repository.