Skip to content

Commit a1190d8

Browse files
committed
fix: readme update
1 parent 97f3569 commit a1190d8

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

.changeset/pre.json

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"big-swans-rush",
99
"chilled-bears-learn",
1010
"eleven-crabs-breathe",
11+
"fifty-zoos-wait",
1112
"light-pandas-whisper",
1213
"old-onions-invite",
1314
"rare-knives-drive",

README.md

+14-12
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ const getTodos = async (id: number) => {
5454
getTodos(1);
5555
```
5656

57-
5857
## Example with Schema Validation (with Zod)
5958

6059
```typescript
@@ -72,24 +71,27 @@ const apiClient = new Aspi({
7271
const getTodo = async (id: number) => {
7372
const response = await apiClient
7473
.get(`/todos/${id}`)
75-
.output(z.object({
76-
id: z.number(),
77-
title: z.string(),
78-
completed: z.boolean(),
79-
}))
74+
.output(
75+
z.object({
76+
id: z.number(),
77+
title: z.string(),
78+
completed: z.boolean(),
79+
}),
80+
)
8081
.json();
8182

8283
Result.match(response, {
8384
onOk: (data) => {
8485
console.log(data);
8586
},
86-
onErr: err => {
87-
if(err.tag === "parseError"){
87+
onErr: (err) => {
88+
if (err.tag === 'parseError') {
8889
const error = err.data as ZodError;
8990
console.error(error.errors);
90-
}else {
91+
} else {
9192
// do something else
9293
}
93-
}
94-
})
95-
}
94+
},
95+
});
96+
};
97+
```

0 commit comments

Comments
 (0)