Effect CommunityEC
Effect Community2y ago
8 replies
Eduardo

Using `tryPromise` with parameters?

Hey, maybe I'm reeding the docs bad or I'm just stupid but is there a way to use tryPromise here passing the lat and lng args
const fetchOpenUV = async (lat: number, lng: number) => {
  const values = await trpc.openUVRouter.fetchUV.query({
    lat: lat,
    lng: lng,
    cache: true,
  });
  return values;
};

const updateUV = pipe(
  getCurrentPosition,
  Effect.map((position) =>
    fetchOpenUV(position.coords.latitude, position.coords.longitude)
  ),
);


updateUV is of the tipe pdateUV: Effect.Effect<never, GeolocationPositionError, Promise<something>> Is there a way to resolve the promise, I need to resolve it in the pipeline or update the fetchOpenUV function ?
Was this page helpful?