@hey-api/openapi-ts 0.92.2 → 0.92.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -53,10 +53,11 @@ export const createClient = (config: Config = {}): Client => {
53
53
  >();
54
54
 
55
55
  const requestOptions = <
56
+ TData = unknown,
56
57
  ThrowOnError extends boolean = false,
57
58
  TResponseStyle extends ResponseStyle = 'fields',
58
59
  >(
59
- options: RequestOptions<unknown, TResponseStyle, ThrowOnError>,
60
+ options: RequestOptions<TData, TResponseStyle, ThrowOnError>,
60
61
  ) => {
61
62
  const opts = {
62
63
  ..._config,
@@ -170,11 +170,12 @@ type RequestFn = <
170
170
  ) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
171
171
 
172
172
  type RequestOptionsFn = <
173
+ T,
173
174
  ThrowOnError extends boolean = false,
174
175
  TResponseStyle extends ResponseStyle = 'fields',
175
176
  >(
176
- options: RequestOptions<unknown, TResponseStyle, ThrowOnError>,
177
- ) => HttpRequest<unknown>;
177
+ options: RequestOptions<T, TResponseStyle, ThrowOnError>,
178
+ ) => HttpRequest<T>;
178
179
 
179
180
  type BuildUrlFn = <
180
181
  TData extends {
@@ -1,5 +1,5 @@
1
1
  import { useAsyncData, useFetch, useLazyAsyncData, useLazyFetch } from 'nuxt/app';
2
- import { reactive, ref, watch } from 'vue';
2
+ import { reactive, ref, toValue, watch } from 'vue';
3
3
 
4
4
  import { createSseClient } from '../core/serverSentEvents';
5
5
  import type { HttpMethod } from '../core/types';
@@ -136,14 +136,14 @@ export const createClient = (config: Config = {}): Client => {
136
136
  body: opts.body,
137
137
  bodySerializer: opts.bodySerializer,
138
138
  });
139
- const body = ref(serializeBody(opts));
139
+ const body = ref(serializeBody({ ...opts, body: toValue(opts.body) }));
140
140
  opts.body = body;
141
141
  watch(bodyParams, (changed) => {
142
142
  body.value = serializeBody(changed);
143
143
  });
144
144
  return composable === 'useLazyFetch'
145
- ? useLazyFetch(() => buildUrl(opts), opts)
146
- : useFetch(() => buildUrl(opts), opts);
145
+ ? useLazyFetch(() => buildUrl(opts), { ...opts, ...asyncDataOptions })
146
+ : useFetch(() => buildUrl(opts), { ...opts, ...asyncDataOptions });
147
147
  }
148
148
 
149
149
  const handler: any = () =>