@squonk/account-server-client 0.1.27-rc.1 → 0.1.29-rc.1
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.
- package/{chunk-GWBPVOL2.js → chunk-6EEIAH4R.js} +23 -2
- package/chunk-6EEIAH4R.js.map +1 -0
- package/chunk-NGBTCJWS.cjs +46 -0
- package/chunk-NGBTCJWS.cjs.map +1 -0
- package/{account-server-api.schemas-e6c5f956.d.ts → custom-instance-13412a15.d.ts} +19 -1
- package/index.cjs +5 -21
- package/index.cjs.map +1 -1
- package/index.d.ts +2 -20
- package/index.js +5 -21
- package/index.js.map +1 -1
- package/organisation/organisation.cjs +35 -30
- package/organisation/organisation.cjs.map +1 -1
- package/organisation/organisation.d.ts +33 -32
- package/organisation/organisation.js +42 -37
- package/organisation/organisation.js.map +1 -1
- package/package.json +1 -1
- package/product/product.cjs +65 -53
- package/product/product.cjs.map +1 -1
- package/product/product.d.ts +55 -54
- package/product/product.js +76 -64
- package/product/product.js.map +1 -1
- package/service/service.cjs +21 -23
- package/service/service.cjs.map +1 -1
- package/service/service.d.ts +18 -17
- package/service/service.js +23 -25
- package/service/service.js.map +1 -1
- package/src/organisation/organisation.ts +93 -69
- package/src/product/product.ts +165 -146
- package/src/service/service.ts +59 -57
- package/src/state/state.ts +34 -28
- package/src/unit/unit.ts +145 -130
- package/src/user/user.ts +148 -120
- package/state/state.cjs +12 -12
- package/state/state.cjs.map +1 -1
- package/state/state.d.ts +11 -10
- package/state/state.js +13 -13
- package/state/state.js.map +1 -1
- package/unit/unit.cjs +55 -50
- package/unit/unit.cjs.map +1 -1
- package/unit/unit.d.ts +54 -53
- package/unit/unit.js +66 -61
- package/unit/unit.js.map +1 -1
- package/user/user.cjs +50 -50
- package/user/user.cjs.map +1 -1
- package/user/user.d.ts +53 -52
- package/user/user.js +61 -61
- package/user/user.js.map +1 -1
- package/chunk-GWBPVOL2.js.map +0 -1
- package/chunk-N3RLW53G.cjs +0 -25
- package/chunk-N3RLW53G.cjs.map +0 -1
package/src/unit/unit.ts
CHANGED
|
@@ -8,7 +8,6 @@ A service that provides access to the Account Server, which gives *registered* u
|
|
|
8
8
|
|
|
9
9
|
* OpenAPI spec version: 0.1
|
|
10
10
|
*/
|
|
11
|
-
import axios, { AxiosRequestConfig, AxiosResponse, AxiosError } from "axios";
|
|
12
11
|
import {
|
|
13
12
|
useQuery,
|
|
14
13
|
useMutation,
|
|
@@ -28,6 +27,7 @@ import type {
|
|
|
28
27
|
UnitsGetResponse,
|
|
29
28
|
PersonalUnitPutResponse,
|
|
30
29
|
} from "../account-server-api.schemas";
|
|
30
|
+
import { customInstance, ErrorType } from ".././custom-instance";
|
|
31
31
|
|
|
32
32
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
33
33
|
type AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (
|
|
@@ -36,52 +36,63 @@ type AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (
|
|
|
36
36
|
? R
|
|
37
37
|
: any;
|
|
38
38
|
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
40
|
+
type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
41
|
+
config: any,
|
|
42
|
+
args: infer P
|
|
43
|
+
) => any
|
|
44
|
+
? P
|
|
45
|
+
: never;
|
|
46
|
+
|
|
39
47
|
/**
|
|
40
48
|
* Gets Organisational Units you have access to or that are public
|
|
41
49
|
|
|
42
50
|
* @summary Gets Organisational Units
|
|
43
51
|
*/
|
|
44
|
-
export const
|
|
52
|
+
export const getOrganisationUnits = (
|
|
45
53
|
orgId: string,
|
|
46
|
-
options?:
|
|
47
|
-
)
|
|
48
|
-
return
|
|
54
|
+
options?: SecondParameter<typeof customInstance>
|
|
55
|
+
) => {
|
|
56
|
+
return customInstance<OrganisationUnitsGetResponse>(
|
|
57
|
+
{ url: `/organisation/${orgId}/unit`, method: "get" },
|
|
58
|
+
options
|
|
59
|
+
);
|
|
49
60
|
};
|
|
50
61
|
|
|
51
|
-
export const
|
|
62
|
+
export const getGetOrganisationUnitsQueryKey = (orgId: string) => [
|
|
52
63
|
`/organisation/${orgId}/unit`,
|
|
53
64
|
];
|
|
54
65
|
|
|
55
|
-
export type
|
|
56
|
-
AsyncReturnType<typeof
|
|
66
|
+
export type GetOrganisationUnitsQueryResult = NonNullable<
|
|
67
|
+
AsyncReturnType<typeof getOrganisationUnits>
|
|
57
68
|
>;
|
|
58
|
-
export type
|
|
69
|
+
export type GetOrganisationUnitsQueryError = ErrorType<void | AsError>;
|
|
59
70
|
|
|
60
|
-
export const
|
|
61
|
-
TData = AsyncReturnType<typeof
|
|
62
|
-
TError =
|
|
71
|
+
export const useGetOrganisationUnits = <
|
|
72
|
+
TData = AsyncReturnType<typeof getOrganisationUnits>,
|
|
73
|
+
TError = ErrorType<void | AsError>
|
|
63
74
|
>(
|
|
64
75
|
orgId: string,
|
|
65
76
|
options?: {
|
|
66
77
|
query?: UseQueryOptions<
|
|
67
|
-
AsyncReturnType<typeof
|
|
78
|
+
AsyncReturnType<typeof getOrganisationUnits>,
|
|
68
79
|
TError,
|
|
69
80
|
TData
|
|
70
81
|
>;
|
|
71
|
-
|
|
82
|
+
request?: SecondParameter<typeof customInstance>;
|
|
72
83
|
}
|
|
73
84
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
74
|
-
const { query: queryOptions,
|
|
85
|
+
const { query: queryOptions, request: requestOptions } = options || {};
|
|
75
86
|
|
|
76
87
|
const queryKey =
|
|
77
|
-
queryOptions?.queryKey ??
|
|
88
|
+
queryOptions?.queryKey ?? getGetOrganisationUnitsQueryKey(orgId);
|
|
78
89
|
|
|
79
90
|
const queryFn: QueryFunction<
|
|
80
|
-
AsyncReturnType<typeof
|
|
81
|
-
> = () =>
|
|
91
|
+
AsyncReturnType<typeof getOrganisationUnits>
|
|
92
|
+
> = () => getOrganisationUnits(orgId, requestOptions);
|
|
82
93
|
|
|
83
94
|
const query = useQuery<
|
|
84
|
-
AsyncReturnType<typeof
|
|
95
|
+
AsyncReturnType<typeof getOrganisationUnits>,
|
|
85
96
|
TError,
|
|
86
97
|
TData
|
|
87
98
|
>(queryKey, queryFn, { enabled: !!orgId, ...queryOptions });
|
|
@@ -97,49 +108,53 @@ export const useAppApiUnitGetOrgUnits = <
|
|
|
97
108
|
|
|
98
109
|
* @summary Create a new Organisational Unit
|
|
99
110
|
*/
|
|
100
|
-
export const
|
|
111
|
+
export const createOrganisationUnit = (
|
|
101
112
|
orgId: string,
|
|
102
113
|
organisationUnitPostBodyBody: OrganisationUnitPostBodyBody,
|
|
103
|
-
options?:
|
|
104
|
-
)
|
|
105
|
-
return
|
|
106
|
-
|
|
107
|
-
|
|
114
|
+
options?: SecondParameter<typeof customInstance>
|
|
115
|
+
) => {
|
|
116
|
+
return customInstance<OrganisationUnitPostResponse>(
|
|
117
|
+
{
|
|
118
|
+
url: `/organisation/${orgId}/unit`,
|
|
119
|
+
method: "post",
|
|
120
|
+
headers: { "Content-Type": "application/json" },
|
|
121
|
+
data: organisationUnitPostBodyBody,
|
|
122
|
+
},
|
|
108
123
|
options
|
|
109
124
|
);
|
|
110
125
|
};
|
|
111
126
|
|
|
112
|
-
export type
|
|
113
|
-
AsyncReturnType<typeof
|
|
127
|
+
export type CreateOrganisationUnitMutationResult = NonNullable<
|
|
128
|
+
AsyncReturnType<typeof createOrganisationUnit>
|
|
114
129
|
>;
|
|
115
|
-
export type
|
|
116
|
-
export type
|
|
130
|
+
export type CreateOrganisationUnitMutationBody = OrganisationUnitPostBodyBody;
|
|
131
|
+
export type CreateOrganisationUnitMutationError = ErrorType<AsError | void>;
|
|
117
132
|
|
|
118
|
-
export const
|
|
119
|
-
TError =
|
|
133
|
+
export const useCreateOrganisationUnit = <
|
|
134
|
+
TError = ErrorType<AsError | void>,
|
|
120
135
|
TContext = unknown
|
|
121
136
|
>(options?: {
|
|
122
137
|
mutation?: UseMutationOptions<
|
|
123
|
-
AsyncReturnType<typeof
|
|
138
|
+
AsyncReturnType<typeof createOrganisationUnit>,
|
|
124
139
|
TError,
|
|
125
140
|
{ orgId: string; data: OrganisationUnitPostBodyBody },
|
|
126
141
|
TContext
|
|
127
142
|
>;
|
|
128
|
-
|
|
143
|
+
request?: SecondParameter<typeof customInstance>;
|
|
129
144
|
}) => {
|
|
130
|
-
const { mutation: mutationOptions,
|
|
145
|
+
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
131
146
|
|
|
132
147
|
const mutationFn: MutationFunction<
|
|
133
|
-
AsyncReturnType<typeof
|
|
148
|
+
AsyncReturnType<typeof createOrganisationUnit>,
|
|
134
149
|
{ orgId: string; data: OrganisationUnitPostBodyBody }
|
|
135
150
|
> = (props) => {
|
|
136
151
|
const { orgId, data } = props || {};
|
|
137
152
|
|
|
138
|
-
return
|
|
153
|
+
return createOrganisationUnit(orgId, data, requestOptions);
|
|
139
154
|
};
|
|
140
155
|
|
|
141
156
|
return useMutation<
|
|
142
|
-
AsyncReturnType<typeof
|
|
157
|
+
AsyncReturnType<typeof createOrganisationUnit>,
|
|
143
158
|
TError,
|
|
144
159
|
{ orgId: string; data: OrganisationUnitPostBodyBody },
|
|
145
160
|
TContext
|
|
@@ -150,52 +165,47 @@ export const useAppApiUnitPost = <
|
|
|
150
165
|
|
|
151
166
|
* @summary Gets a Unit
|
|
152
167
|
*/
|
|
153
|
-
export const
|
|
168
|
+
export const getUnit = (
|
|
154
169
|
orgId: string,
|
|
155
170
|
unitId: string,
|
|
156
|
-
options?:
|
|
157
|
-
)
|
|
158
|
-
return
|
|
171
|
+
options?: SecondParameter<typeof customInstance>
|
|
172
|
+
) => {
|
|
173
|
+
return customInstance<UnitGetResponse>(
|
|
174
|
+
{ url: `/organisation/${orgId}/unit/${unitId}`, method: "get" },
|
|
175
|
+
options
|
|
176
|
+
);
|
|
159
177
|
};
|
|
160
178
|
|
|
161
|
-
export const
|
|
179
|
+
export const getGetUnitQueryKey = (orgId: string, unitId: string) => [
|
|
162
180
|
`/organisation/${orgId}/unit/${unitId}`,
|
|
163
181
|
];
|
|
164
182
|
|
|
165
|
-
export type
|
|
166
|
-
|
|
167
|
-
>;
|
|
168
|
-
export type AppApiUnitGetUnitQueryError = AxiosError<void | AsError>;
|
|
183
|
+
export type GetUnitQueryResult = NonNullable<AsyncReturnType<typeof getUnit>>;
|
|
184
|
+
export type GetUnitQueryError = ErrorType<void | AsError>;
|
|
169
185
|
|
|
170
|
-
export const
|
|
171
|
-
TData = AsyncReturnType<typeof
|
|
172
|
-
TError =
|
|
186
|
+
export const useGetUnit = <
|
|
187
|
+
TData = AsyncReturnType<typeof getUnit>,
|
|
188
|
+
TError = ErrorType<void | AsError>
|
|
173
189
|
>(
|
|
174
190
|
orgId: string,
|
|
175
191
|
unitId: string,
|
|
176
192
|
options?: {
|
|
177
|
-
query?: UseQueryOptions<
|
|
178
|
-
|
|
179
|
-
TError,
|
|
180
|
-
TData
|
|
181
|
-
>;
|
|
182
|
-
axios?: AxiosRequestConfig;
|
|
193
|
+
query?: UseQueryOptions<AsyncReturnType<typeof getUnit>, TError, TData>;
|
|
194
|
+
request?: SecondParameter<typeof customInstance>;
|
|
183
195
|
}
|
|
184
196
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
185
|
-
const { query: queryOptions,
|
|
197
|
+
const { query: queryOptions, request: requestOptions } = options || {};
|
|
186
198
|
|
|
187
|
-
const queryKey =
|
|
188
|
-
queryOptions?.queryKey ?? getAppApiUnitGetUnitQueryKey(orgId, unitId);
|
|
199
|
+
const queryKey = queryOptions?.queryKey ?? getGetUnitQueryKey(orgId, unitId);
|
|
189
200
|
|
|
190
|
-
const queryFn: QueryFunction<
|
|
191
|
-
|
|
192
|
-
> = () => appApiUnitGetUnit(orgId, unitId, axiosOptions);
|
|
201
|
+
const queryFn: QueryFunction<AsyncReturnType<typeof getUnit>> = () =>
|
|
202
|
+
getUnit(orgId, unitId, requestOptions);
|
|
193
203
|
|
|
194
|
-
const query = useQuery<
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
204
|
+
const query = useQuery<AsyncReturnType<typeof getUnit>, TError, TData>(
|
|
205
|
+
queryKey,
|
|
206
|
+
queryFn,
|
|
207
|
+
{ enabled: !!(orgId && unitId), ...queryOptions }
|
|
208
|
+
);
|
|
199
209
|
|
|
200
210
|
return {
|
|
201
211
|
queryKey,
|
|
@@ -208,45 +218,48 @@ export const useAppApiUnitGetUnit = <
|
|
|
208
218
|
|
|
209
219
|
* @summary Deletes an Organisational Unit
|
|
210
220
|
*/
|
|
211
|
-
export const
|
|
221
|
+
export const deleteOrganisationUnit = (
|
|
212
222
|
orgId: string,
|
|
213
223
|
unitId: string,
|
|
214
|
-
options?:
|
|
215
|
-
)
|
|
216
|
-
return
|
|
224
|
+
options?: SecondParameter<typeof customInstance>
|
|
225
|
+
) => {
|
|
226
|
+
return customInstance<void>(
|
|
227
|
+
{ url: `/organisation/${orgId}/unit/${unitId}`, method: "delete" },
|
|
228
|
+
options
|
|
229
|
+
);
|
|
217
230
|
};
|
|
218
231
|
|
|
219
|
-
export type
|
|
220
|
-
AsyncReturnType<typeof
|
|
232
|
+
export type DeleteOrganisationUnitMutationResult = NonNullable<
|
|
233
|
+
AsyncReturnType<typeof deleteOrganisationUnit>
|
|
221
234
|
>;
|
|
222
235
|
|
|
223
|
-
export type
|
|
236
|
+
export type DeleteOrganisationUnitMutationError = ErrorType<AsError>;
|
|
224
237
|
|
|
225
|
-
export const
|
|
226
|
-
TError =
|
|
238
|
+
export const useDeleteOrganisationUnit = <
|
|
239
|
+
TError = ErrorType<AsError>,
|
|
227
240
|
TContext = unknown
|
|
228
241
|
>(options?: {
|
|
229
242
|
mutation?: UseMutationOptions<
|
|
230
|
-
AsyncReturnType<typeof
|
|
243
|
+
AsyncReturnType<typeof deleteOrganisationUnit>,
|
|
231
244
|
TError,
|
|
232
245
|
{ orgId: string; unitId: string },
|
|
233
246
|
TContext
|
|
234
247
|
>;
|
|
235
|
-
|
|
248
|
+
request?: SecondParameter<typeof customInstance>;
|
|
236
249
|
}) => {
|
|
237
|
-
const { mutation: mutationOptions,
|
|
250
|
+
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
238
251
|
|
|
239
252
|
const mutationFn: MutationFunction<
|
|
240
|
-
AsyncReturnType<typeof
|
|
253
|
+
AsyncReturnType<typeof deleteOrganisationUnit>,
|
|
241
254
|
{ orgId: string; unitId: string }
|
|
242
255
|
> = (props) => {
|
|
243
256
|
const { orgId, unitId } = props || {};
|
|
244
257
|
|
|
245
|
-
return
|
|
258
|
+
return deleteOrganisationUnit(orgId, unitId, requestOptions);
|
|
246
259
|
};
|
|
247
260
|
|
|
248
261
|
return useMutation<
|
|
249
|
-
AsyncReturnType<typeof
|
|
262
|
+
AsyncReturnType<typeof deleteOrganisationUnit>,
|
|
250
263
|
TError,
|
|
251
264
|
{ orgId: string; unitId: string },
|
|
252
265
|
TContext
|
|
@@ -257,34 +270,33 @@ export const useAppApiUnitDelete = <
|
|
|
257
270
|
|
|
258
271
|
* @summary Gets Units
|
|
259
272
|
*/
|
|
260
|
-
export const
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
273
|
+
export const getUnits = (options?: SecondParameter<typeof customInstance>) => {
|
|
274
|
+
return customInstance<UnitsGetResponse>(
|
|
275
|
+
{ url: `/unit`, method: "get" },
|
|
276
|
+
options
|
|
277
|
+
);
|
|
264
278
|
};
|
|
265
279
|
|
|
266
|
-
export const
|
|
280
|
+
export const getGetUnitsQueryKey = () => [`/unit`];
|
|
267
281
|
|
|
268
|
-
export type
|
|
269
|
-
|
|
270
|
-
>;
|
|
271
|
-
export type AppApiUnitGetQueryError = AxiosError<void | AsError>;
|
|
282
|
+
export type GetUnitsQueryResult = NonNullable<AsyncReturnType<typeof getUnits>>;
|
|
283
|
+
export type GetUnitsQueryError = ErrorType<void | AsError>;
|
|
272
284
|
|
|
273
|
-
export const
|
|
274
|
-
TData = AsyncReturnType<typeof
|
|
275
|
-
TError =
|
|
285
|
+
export const useGetUnits = <
|
|
286
|
+
TData = AsyncReturnType<typeof getUnits>,
|
|
287
|
+
TError = ErrorType<void | AsError>
|
|
276
288
|
>(options?: {
|
|
277
|
-
query?: UseQueryOptions<AsyncReturnType<typeof
|
|
278
|
-
|
|
289
|
+
query?: UseQueryOptions<AsyncReturnType<typeof getUnits>, TError, TData>;
|
|
290
|
+
request?: SecondParameter<typeof customInstance>;
|
|
279
291
|
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
280
|
-
const { query: queryOptions,
|
|
292
|
+
const { query: queryOptions, request: requestOptions } = options || {};
|
|
281
293
|
|
|
282
|
-
const queryKey = queryOptions?.queryKey ??
|
|
294
|
+
const queryKey = queryOptions?.queryKey ?? getGetUnitsQueryKey();
|
|
283
295
|
|
|
284
|
-
const queryFn: QueryFunction<AsyncReturnType<typeof
|
|
285
|
-
|
|
296
|
+
const queryFn: QueryFunction<AsyncReturnType<typeof getUnits>> = () =>
|
|
297
|
+
getUnits(requestOptions);
|
|
286
298
|
|
|
287
|
-
const query = useQuery<AsyncReturnType<typeof
|
|
299
|
+
const query = useQuery<AsyncReturnType<typeof getUnits>, TError, TData>(
|
|
288
300
|
queryKey,
|
|
289
301
|
queryFn,
|
|
290
302
|
queryOptions
|
|
@@ -301,42 +313,45 @@ export const useAppApiUnitGet = <
|
|
|
301
313
|
|
|
302
314
|
* @summary Create a new Independent User Unit
|
|
303
315
|
*/
|
|
304
|
-
export const
|
|
305
|
-
options?:
|
|
306
|
-
)
|
|
307
|
-
return
|
|
316
|
+
export const createDefaultUnit = (
|
|
317
|
+
options?: SecondParameter<typeof customInstance>
|
|
318
|
+
) => {
|
|
319
|
+
return customInstance<PersonalUnitPutResponse>(
|
|
320
|
+
{ url: `/unit`, method: "put" },
|
|
321
|
+
options
|
|
322
|
+
);
|
|
308
323
|
};
|
|
309
324
|
|
|
310
|
-
export type
|
|
311
|
-
AsyncReturnType<typeof
|
|
325
|
+
export type CreateDefaultUnitMutationResult = NonNullable<
|
|
326
|
+
AsyncReturnType<typeof createDefaultUnit>
|
|
312
327
|
>;
|
|
313
328
|
|
|
314
|
-
export type
|
|
329
|
+
export type CreateDefaultUnitMutationError = ErrorType<AsError | void>;
|
|
315
330
|
|
|
316
|
-
export const
|
|
317
|
-
TError =
|
|
331
|
+
export const useCreateDefaultUnit = <
|
|
332
|
+
TError = ErrorType<AsError | void>,
|
|
318
333
|
TVariables = void,
|
|
319
334
|
TContext = unknown
|
|
320
335
|
>(options?: {
|
|
321
336
|
mutation?: UseMutationOptions<
|
|
322
|
-
AsyncReturnType<typeof
|
|
337
|
+
AsyncReturnType<typeof createDefaultUnit>,
|
|
323
338
|
TError,
|
|
324
339
|
TVariables,
|
|
325
340
|
TContext
|
|
326
341
|
>;
|
|
327
|
-
|
|
342
|
+
request?: SecondParameter<typeof customInstance>;
|
|
328
343
|
}) => {
|
|
329
|
-
const { mutation: mutationOptions,
|
|
344
|
+
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
330
345
|
|
|
331
346
|
const mutationFn: MutationFunction<
|
|
332
|
-
AsyncReturnType<typeof
|
|
347
|
+
AsyncReturnType<typeof createDefaultUnit>,
|
|
333
348
|
TVariables
|
|
334
349
|
> = () => {
|
|
335
|
-
return
|
|
350
|
+
return createDefaultUnit(requestOptions);
|
|
336
351
|
};
|
|
337
352
|
|
|
338
353
|
return useMutation<
|
|
339
|
-
AsyncReturnType<typeof
|
|
354
|
+
AsyncReturnType<typeof createDefaultUnit>,
|
|
340
355
|
TError,
|
|
341
356
|
TVariables,
|
|
342
357
|
TContext
|
|
@@ -347,42 +362,42 @@ export const useAppApiUnitPersonalPut = <
|
|
|
347
362
|
|
|
348
363
|
* @summary Deletes an Independent Unit
|
|
349
364
|
*/
|
|
350
|
-
export const
|
|
351
|
-
options?:
|
|
352
|
-
)
|
|
353
|
-
return
|
|
365
|
+
export const deleteDefaultUnit = (
|
|
366
|
+
options?: SecondParameter<typeof customInstance>
|
|
367
|
+
) => {
|
|
368
|
+
return customInstance<void>({ url: `/unit`, method: "delete" }, options);
|
|
354
369
|
};
|
|
355
370
|
|
|
356
|
-
export type
|
|
357
|
-
AsyncReturnType<typeof
|
|
371
|
+
export type DeleteDefaultUnitMutationResult = NonNullable<
|
|
372
|
+
AsyncReturnType<typeof deleteDefaultUnit>
|
|
358
373
|
>;
|
|
359
374
|
|
|
360
|
-
export type
|
|
375
|
+
export type DeleteDefaultUnitMutationError = ErrorType<AsError>;
|
|
361
376
|
|
|
362
|
-
export const
|
|
363
|
-
TError =
|
|
377
|
+
export const useDeleteDefaultUnit = <
|
|
378
|
+
TError = ErrorType<AsError>,
|
|
364
379
|
TVariables = void,
|
|
365
380
|
TContext = unknown
|
|
366
381
|
>(options?: {
|
|
367
382
|
mutation?: UseMutationOptions<
|
|
368
|
-
AsyncReturnType<typeof
|
|
383
|
+
AsyncReturnType<typeof deleteDefaultUnit>,
|
|
369
384
|
TError,
|
|
370
385
|
TVariables,
|
|
371
386
|
TContext
|
|
372
387
|
>;
|
|
373
|
-
|
|
388
|
+
request?: SecondParameter<typeof customInstance>;
|
|
374
389
|
}) => {
|
|
375
|
-
const { mutation: mutationOptions,
|
|
390
|
+
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
376
391
|
|
|
377
392
|
const mutationFn: MutationFunction<
|
|
378
|
-
AsyncReturnType<typeof
|
|
393
|
+
AsyncReturnType<typeof deleteDefaultUnit>,
|
|
379
394
|
TVariables
|
|
380
395
|
> = () => {
|
|
381
|
-
return
|
|
396
|
+
return deleteDefaultUnit(requestOptions);
|
|
382
397
|
};
|
|
383
398
|
|
|
384
399
|
return useMutation<
|
|
385
|
-
AsyncReturnType<typeof
|
|
400
|
+
AsyncReturnType<typeof deleteDefaultUnit>,
|
|
386
401
|
TError,
|
|
387
402
|
TVariables,
|
|
388
403
|
TContext
|