Skip to content

Commit f9de951

Browse files
no need of .of
1 parent bbf6058 commit f9de951

File tree

1 file changed

+16
-19
lines changed

1 file changed

+16
-19
lines changed

src/PokeApi.ts

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -40,26 +40,23 @@ export class PokeApi extends Context.Tag("PokeApi")<
4040
Layer.provide(Layer.mergeAll(PokemonCollection.Live, BuildPokeApiUrl.Live))
4141
);
4242

43-
static readonly Test = Layer.succeed(
44-
this,
45-
PokeApi.of({
46-
getPokemon: Effect.gen(function* () {
47-
const response = yield* Effect.tryPromise({
48-
try: () => fetch(`http://localhost:3000/api/v2/pokemon/garchomp/`),
49-
catch: () => new FetchError(),
50-
});
43+
static readonly Test = Layer.succeed(this, {
44+
getPokemon: Effect.gen(function* () {
45+
const response = yield* Effect.tryPromise({
46+
try: () => fetch(`http://localhost:3000/api/v2/pokemon/garchomp/`),
47+
catch: () => new FetchError(),
48+
});
5149

52-
if (!response.ok) {
53-
return yield* new FetchError();
54-
}
50+
if (!response.ok) {
51+
return yield* new FetchError();
52+
}
5553

56-
const json = yield* Effect.tryPromise({
57-
try: () => response.json(),
58-
catch: () => new JsonError(),
59-
});
54+
const json = yield* Effect.tryPromise({
55+
try: () => response.json(),
56+
catch: () => new JsonError(),
57+
});
6058

61-
return yield* Schema.decodeUnknown(Pokemon)(json);
62-
}),
63-
})
64-
);
59+
return yield* Schema.decodeUnknown(Pokemon)(json);
60+
}),
61+
});
6562
}

0 commit comments

Comments
 (0)