@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 07:15 UTC

main
ts 12 lines 625 Bytes
Raw
1 import * as Effect from "effect/Effect";
2 import * as HttpApiClient from "effect/http-api/HttpApiClient";
3 import * as FetchHttpClient from "effect/http/FetchHttpClient";
4 import { ShortyApi } from "./ShortyApi.ts";
5
6 export const API_URL = import.meta.env.VITE_API_URL as string;
7
8 // A typed client derived from the same `ShortyApi` value the Worker serves.
9 const makeClient = HttpApiClient.make(ShortyApi, { baseUrl: API_URL });
10
11 export const call = <A, E>(f: (client: Effect.Success<typeof makeClient>) => Effect.Effect<A, E>) =>
12 Effect.runPromise(makeClient.pipe(Effect.flatMap(f), Effect.provide(FetchHttpClient.layer)));