@@ -39,7 +39,7 @@ Then, e.g., in your code:
39
39
})
40
40
41
41
// Perform the request, use `makeParse` to pass a transformer for the data
42
- const { data, error } = useFetch('https://httpbin.org/uuid', {
42
+ const { data, error } = await useFetch('https://httpbin.org/uuid', {
43
43
transform: makeParser(responseSchema),
44
44
})
45
45
@@ -59,7 +59,7 @@ Then, e.g., in your code:
59
59
})
60
60
61
61
// Perform the request, use `makeParse` to pass a transformer for the data
62
- const { data, error } = useFetch (' https://httpbin.org/ip' , {
62
+ const { data, error } = await useFetch (' https://httpbin.org/ip' , {
63
63
transform: makeParser (responseSchema ),
64
64
})
65
65
@@ -121,14 +121,12 @@ Then, e.g., in your code:
121
121
122
122
const parsedData = await parseDataAs({ test: 1 }, z.object({ test: z.number() )}))
123
123
console.log(parsedData)
124
- // -> output: ` 1 `
124
+ // -> output: ` { test : 1 } `
125
125
126
126
127
127
const parsedData = await parseDataAs({ test: "1" }, z.object({ test: z.string().transform(v => parseInt(v)) )}))
128
128
console.log(parsedData)
129
- // -> output: ` 1 ` (we used ` .transform ` to ensure that we get a number)
130
-
131
-
129
+ // -> output: ` { test : 1 }` (we used ` .transform ` to ensure that we get a number)
132
130
` ` `
133
131
- Also works with async data , e .g ., when fetching from another API or DB :
134
132
` ` ` ts
@@ -165,3 +163,10 @@ This module exports:
165
163
166
164
[license - src ]: https :// img.shields.io/npm/l/@sidebase/nuxt-parse.svg
167
165
[license - href ]: https :// npmjs.com/package/@sidebase/nuxt-parse
166
+
167
+ ## Development
168
+
169
+ - Run ` npm run test ` to generate type stubs
170
+ - Run `npm run lint` to run eslint
171
+ - Run `npm run type` to run typescheck via tsc
172
+ - Run `npm publish` to run build and publish the package
0 commit comments