usePromise
All checks were successful
Lint / lint (push) Successful in 10s

This commit is contained in:
Julien Valverdé
2025-02-19 23:44:02 +01:00
parent 9e7b30fbb4
commit 65810a6d79
2 changed files with 15 additions and 62 deletions

View File

@@ -15,9 +15,8 @@ const Result = Schema.Tuple(Schema.String)
type Result = typeof Result.Type
function RouteComponent() {
const promise = R.usePromiseScoped(Effect.addFinalizer(() => Console.log("Cleanup")).pipe(
Effect.andThen(HttpClient.HttpClient),
Effect.flatMap(client => client.get("https://www.uuidtools.com/api/generate/v4")),
const promise = R.usePromise(Effect.addFinalizer(() => Console.log("Cleanup")).pipe(
Effect.andThen(HttpClient.get("https://www.uuidtools.com/api/generate/v4")),
HttpClient.withTracerPropagation(false),
Effect.flatMap(res => res.json),
Effect.flatMap(Schema.decodeUnknown(Result)),