@squonk/account-server-client 0.1.27-rc.1 → 0.1.28-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/service/service.js
CHANGED
|
@@ -1,46 +1,44 @@
|
|
|
1
1
|
import {
|
|
2
|
-
__spreadValues
|
|
3
|
-
|
|
2
|
+
__spreadValues,
|
|
3
|
+
customInstance
|
|
4
|
+
} from "../chunk-6EEIAH4R.js";
|
|
4
5
|
|
|
5
6
|
// src/service/service.ts
|
|
6
|
-
import axios from "axios";
|
|
7
7
|
import {
|
|
8
8
|
useQuery
|
|
9
9
|
} from "react-query";
|
|
10
|
-
var
|
|
11
|
-
return
|
|
10
|
+
var getServices = (options) => {
|
|
11
|
+
return customInstance({ url: `/service`, method: "get" }, options);
|
|
12
12
|
};
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
const { query: queryOptions,
|
|
16
|
-
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ??
|
|
17
|
-
const queryFn = () =>
|
|
13
|
+
var getGetServicesQueryKey = () => [`/service`];
|
|
14
|
+
var useGetServices = (options) => {
|
|
15
|
+
const { query: queryOptions, request: requestOptions } = options || {};
|
|
16
|
+
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetServicesQueryKey();
|
|
17
|
+
const queryFn = () => getServices(requestOptions);
|
|
18
18
|
const query = useQuery(queryKey, queryFn, queryOptions);
|
|
19
19
|
return __spreadValues({
|
|
20
20
|
queryKey
|
|
21
21
|
}, query);
|
|
22
22
|
};
|
|
23
|
-
var
|
|
24
|
-
return
|
|
23
|
+
var getService = (svcId, options) => {
|
|
24
|
+
return customInstance({ url: `/service/${svcId}`, method: "get" }, options);
|
|
25
25
|
};
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getAppApiServiceGetIdQueryKey(svcId);
|
|
32
|
-
const queryFn = () => appApiServiceGetId(svcId, axiosOptions);
|
|
26
|
+
var getGetServiceQueryKey = (svcId) => [`/service/${svcId}`];
|
|
27
|
+
var useGetService = (svcId, options) => {
|
|
28
|
+
const { query: queryOptions, request: requestOptions } = options || {};
|
|
29
|
+
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetServiceQueryKey(svcId);
|
|
30
|
+
const queryFn = () => getService(svcId, requestOptions);
|
|
33
31
|
const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!svcId }, queryOptions));
|
|
34
32
|
return __spreadValues({
|
|
35
33
|
queryKey
|
|
36
34
|
}, query);
|
|
37
35
|
};
|
|
38
36
|
export {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
getGetServiceQueryKey,
|
|
38
|
+
getGetServicesQueryKey,
|
|
39
|
+
getService,
|
|
40
|
+
getServices,
|
|
41
|
+
useGetService,
|
|
42
|
+
useGetServices
|
|
45
43
|
};
|
|
46
44
|
//# sourceMappingURL=service.js.map
|
package/service/service.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/service/service.ts"],"sourcesContent":["/**\n * Generated by orval v6.7.1 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\nimport
|
|
1
|
+
{"version":3,"sources":["../../src/service/service.ts"],"sourcesContent":["/**\n * Generated by orval v6.7.1 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\nimport {\n useQuery,\n UseQueryOptions,\n QueryFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n ServicesGetResponse,\n AsError,\n ServiceGetResponse,\n} from \"../account-server-api.schemas\";\nimport { customInstance, ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (\n ...args: any\n) => Promise<infer R>\n ? R\n : any;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * Gets services known to the Account Server\n\n * @summary Gets all Services\n */\nexport const getServices = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ServicesGetResponse>(\n { url: `/service`, method: \"get\" },\n options\n );\n};\n\nexport const getGetServicesQueryKey = () => [`/service`];\n\nexport type GetServicesQueryResult = NonNullable<\n AsyncReturnType<typeof getServices>\n>;\nexport type GetServicesQueryError = ErrorType<AsError | void>;\n\nexport const useGetServices = <\n TData = AsyncReturnType<typeof getServices>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getServices>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getGetServicesQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getServices>> = () =>\n getServices(requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getServices>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Gets a known service\n\n * @summary Gets a specific Service\n */\nexport const getService = (\n svcId: number,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ServiceGetResponse>(\n { url: `/service/${svcId}`, method: \"get\" },\n options\n );\n};\n\nexport const getGetServiceQueryKey = (svcId: number) => [`/service/${svcId}`];\n\nexport type GetServiceQueryResult = NonNullable<\n AsyncReturnType<typeof getService>\n>;\nexport type GetServiceQueryError = ErrorType<AsError | void>;\n\nexport const useGetService = <\n TData = AsyncReturnType<typeof getService>,\n TError = ErrorType<AsError | void>\n>(\n svcId: number,\n options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getService>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getGetServiceQueryKey(svcId);\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getService>> = () =>\n getService(svcId, requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getService>, TError, TData>(\n queryKey,\n queryFn,\n { enabled: !!svcId, ...queryOptions }\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n"],"mappings":";;;;;;AAUA;AAAA;AAAA;AAkCO,IAAM,cAAc,CACzB,YACG;AACH,SAAO,eACL,EAAE,KAAK,YAAY,QAAQ,MAAM,GACjC,OACF;AACF;AAEO,IAAM,yBAAyB,MAAM,CAAC,UAAU;AAOhD,IAAM,iBAAiB,CAG5B,YAG4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WAAW,8CAAc,aAAY,uBAAuB;AAElE,QAAM,UAA8D,MAClE,YAAY,cAAc;AAE5B,QAAM,QAAQ,SACZ,UACA,SACA,YACF;AAEA,SAAO;AAAA,IACL;AAAA,KACG;AAEP;AAOO,IAAM,aAAa,CACxB,OACA,YACG;AACH,SAAO,eACL,EAAE,KAAK,YAAY,SAAS,QAAQ,MAAM,GAC1C,OACF;AACF;AAEO,IAAM,wBAAwB,CAAC,UAAkB,CAAC,YAAY,OAAO;AAOrE,IAAM,gBAAgB,CAI3B,OACA,YAI2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WAAW,8CAAc,aAAY,sBAAsB,KAAK;AAEtE,QAAM,UAA6D,MACjE,WAAW,OAAO,cAAc;AAElC,QAAM,QAAQ,SACZ,UACA,SACA,iBAAE,SAAS,CAAC,CAAC,SAAU,aACzB;AAEA,SAAO;AAAA,IACL;AAAA,KACG;AAEP;","names":[]}
|
|
@@ -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,
|
|
@@ -26,6 +25,7 @@ import type {
|
|
|
26
25
|
OrganisationPostBodyBody,
|
|
27
26
|
OrganisationGetDefaultResponse,
|
|
28
27
|
} from "../account-server-api.schemas";
|
|
28
|
+
import { customInstance, ErrorType } from ".././custom-instance";
|
|
29
29
|
|
|
30
30
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
31
31
|
type AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (
|
|
@@ -34,45 +34,55 @@ type AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (
|
|
|
34
34
|
? R
|
|
35
35
|
: any;
|
|
36
36
|
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
38
|
+
type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
39
|
+
config: any,
|
|
40
|
+
args: infer P
|
|
41
|
+
) => any
|
|
42
|
+
? P
|
|
43
|
+
: never;
|
|
44
|
+
|
|
37
45
|
/**
|
|
38
46
|
* Gets all the Organisations that you are a member of or are public. Admin users are members of all organisation and can see all Organisations
|
|
39
47
|
|
|
40
48
|
* @summary Gets Organisations
|
|
41
49
|
*/
|
|
42
|
-
export const
|
|
43
|
-
options?:
|
|
44
|
-
)
|
|
45
|
-
return
|
|
50
|
+
export const getOrganisations = (
|
|
51
|
+
options?: SecondParameter<typeof customInstance>
|
|
52
|
+
) => {
|
|
53
|
+
return customInstance<OrganisationsGetResponse>(
|
|
54
|
+
{ url: `/organisation`, method: "get" },
|
|
55
|
+
options
|
|
56
|
+
);
|
|
46
57
|
};
|
|
47
58
|
|
|
48
|
-
export const
|
|
59
|
+
export const getGetOrganisationsQueryKey = () => [`/organisation`];
|
|
49
60
|
|
|
50
|
-
export type
|
|
51
|
-
AsyncReturnType<typeof
|
|
61
|
+
export type GetOrganisationsQueryResult = NonNullable<
|
|
62
|
+
AsyncReturnType<typeof getOrganisations>
|
|
52
63
|
>;
|
|
53
|
-
export type
|
|
64
|
+
export type GetOrganisationsQueryError = ErrorType<void | AsError>;
|
|
54
65
|
|
|
55
|
-
export const
|
|
56
|
-
TData = AsyncReturnType<typeof
|
|
57
|
-
TError =
|
|
66
|
+
export const useGetOrganisations = <
|
|
67
|
+
TData = AsyncReturnType<typeof getOrganisations>,
|
|
68
|
+
TError = ErrorType<void | AsError>
|
|
58
69
|
>(options?: {
|
|
59
70
|
query?: UseQueryOptions<
|
|
60
|
-
AsyncReturnType<typeof
|
|
71
|
+
AsyncReturnType<typeof getOrganisations>,
|
|
61
72
|
TError,
|
|
62
73
|
TData
|
|
63
74
|
>;
|
|
64
|
-
|
|
75
|
+
request?: SecondParameter<typeof customInstance>;
|
|
65
76
|
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
66
|
-
const { query: queryOptions,
|
|
77
|
+
const { query: queryOptions, request: requestOptions } = options || {};
|
|
67
78
|
|
|
68
|
-
const queryKey = queryOptions?.queryKey ??
|
|
79
|
+
const queryKey = queryOptions?.queryKey ?? getGetOrganisationsQueryKey();
|
|
69
80
|
|
|
70
|
-
const queryFn: QueryFunction<
|
|
71
|
-
|
|
72
|
-
> = () => appApiOrganisationGet(axiosOptions);
|
|
81
|
+
const queryFn: QueryFunction<AsyncReturnType<typeof getOrganisations>> = () =>
|
|
82
|
+
getOrganisations(requestOptions);
|
|
73
83
|
|
|
74
84
|
const query = useQuery<
|
|
75
|
-
AsyncReturnType<typeof
|
|
85
|
+
AsyncReturnType<typeof getOrganisations>,
|
|
76
86
|
TError,
|
|
77
87
|
TData
|
|
78
88
|
>(queryKey, queryFn, queryOptions);
|
|
@@ -90,44 +100,52 @@ You need **admin** rights to use this method
|
|
|
90
100
|
|
|
91
101
|
* @summary Create a new organisation
|
|
92
102
|
*/
|
|
93
|
-
export const
|
|
103
|
+
export const createOrganisation = (
|
|
94
104
|
organisationPostBodyBody: OrganisationPostBodyBody,
|
|
95
|
-
options?:
|
|
96
|
-
)
|
|
97
|
-
return
|
|
105
|
+
options?: SecondParameter<typeof customInstance>
|
|
106
|
+
) => {
|
|
107
|
+
return customInstance<OrganisationPostResponse>(
|
|
108
|
+
{
|
|
109
|
+
url: `/organisation`,
|
|
110
|
+
method: "post",
|
|
111
|
+
headers: { "Content-Type": "application/json" },
|
|
112
|
+
data: organisationPostBodyBody,
|
|
113
|
+
},
|
|
114
|
+
options
|
|
115
|
+
);
|
|
98
116
|
};
|
|
99
117
|
|
|
100
|
-
export type
|
|
101
|
-
AsyncReturnType<typeof
|
|
118
|
+
export type CreateOrganisationMutationResult = NonNullable<
|
|
119
|
+
AsyncReturnType<typeof createOrganisation>
|
|
102
120
|
>;
|
|
103
|
-
export type
|
|
104
|
-
export type
|
|
121
|
+
export type CreateOrganisationMutationBody = OrganisationPostBodyBody;
|
|
122
|
+
export type CreateOrganisationMutationError = ErrorType<AsError | void>;
|
|
105
123
|
|
|
106
|
-
export const
|
|
107
|
-
TError =
|
|
124
|
+
export const useCreateOrganisation = <
|
|
125
|
+
TError = ErrorType<AsError | void>,
|
|
108
126
|
TContext = unknown
|
|
109
127
|
>(options?: {
|
|
110
128
|
mutation?: UseMutationOptions<
|
|
111
|
-
AsyncReturnType<typeof
|
|
129
|
+
AsyncReturnType<typeof createOrganisation>,
|
|
112
130
|
TError,
|
|
113
131
|
{ data: OrganisationPostBodyBody },
|
|
114
132
|
TContext
|
|
115
133
|
>;
|
|
116
|
-
|
|
134
|
+
request?: SecondParameter<typeof customInstance>;
|
|
117
135
|
}) => {
|
|
118
|
-
const { mutation: mutationOptions,
|
|
136
|
+
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
119
137
|
|
|
120
138
|
const mutationFn: MutationFunction<
|
|
121
|
-
AsyncReturnType<typeof
|
|
139
|
+
AsyncReturnType<typeof createOrganisation>,
|
|
122
140
|
{ data: OrganisationPostBodyBody }
|
|
123
141
|
> = (props) => {
|
|
124
142
|
const { data } = props || {};
|
|
125
143
|
|
|
126
|
-
return
|
|
144
|
+
return createOrganisation(data, requestOptions);
|
|
127
145
|
};
|
|
128
146
|
|
|
129
147
|
return useMutation<
|
|
130
|
-
AsyncReturnType<typeof
|
|
148
|
+
AsyncReturnType<typeof createOrganisation>,
|
|
131
149
|
TError,
|
|
132
150
|
{ data: OrganisationPostBodyBody },
|
|
133
151
|
TContext
|
|
@@ -140,44 +158,47 @@ You need **admin** rights to use this method
|
|
|
140
158
|
|
|
141
159
|
* @summary Deletes an Organisation
|
|
142
160
|
*/
|
|
143
|
-
export const
|
|
161
|
+
export const deleteOrganisation = (
|
|
144
162
|
orgId: string,
|
|
145
|
-
options?:
|
|
146
|
-
)
|
|
147
|
-
return
|
|
163
|
+
options?: SecondParameter<typeof customInstance>
|
|
164
|
+
) => {
|
|
165
|
+
return customInstance<void>(
|
|
166
|
+
{ url: `/organisation/${orgId}`, method: "delete" },
|
|
167
|
+
options
|
|
168
|
+
);
|
|
148
169
|
};
|
|
149
170
|
|
|
150
|
-
export type
|
|
151
|
-
AsyncReturnType<typeof
|
|
171
|
+
export type DeleteOrganisationMutationResult = NonNullable<
|
|
172
|
+
AsyncReturnType<typeof deleteOrganisation>
|
|
152
173
|
>;
|
|
153
174
|
|
|
154
|
-
export type
|
|
175
|
+
export type DeleteOrganisationMutationError = ErrorType<AsError>;
|
|
155
176
|
|
|
156
|
-
export const
|
|
157
|
-
TError =
|
|
177
|
+
export const useDeleteOrganisation = <
|
|
178
|
+
TError = ErrorType<AsError>,
|
|
158
179
|
TContext = unknown
|
|
159
180
|
>(options?: {
|
|
160
181
|
mutation?: UseMutationOptions<
|
|
161
|
-
AsyncReturnType<typeof
|
|
182
|
+
AsyncReturnType<typeof deleteOrganisation>,
|
|
162
183
|
TError,
|
|
163
184
|
{ orgId: string },
|
|
164
185
|
TContext
|
|
165
186
|
>;
|
|
166
|
-
|
|
187
|
+
request?: SecondParameter<typeof customInstance>;
|
|
167
188
|
}) => {
|
|
168
|
-
const { mutation: mutationOptions,
|
|
189
|
+
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
169
190
|
|
|
170
191
|
const mutationFn: MutationFunction<
|
|
171
|
-
AsyncReturnType<typeof
|
|
192
|
+
AsyncReturnType<typeof deleteOrganisation>,
|
|
172
193
|
{ orgId: string }
|
|
173
194
|
> = (props) => {
|
|
174
195
|
const { orgId } = props || {};
|
|
175
196
|
|
|
176
|
-
return
|
|
197
|
+
return deleteOrganisation(orgId, requestOptions);
|
|
177
198
|
};
|
|
178
199
|
|
|
179
200
|
return useMutation<
|
|
180
|
-
AsyncReturnType<typeof
|
|
201
|
+
AsyncReturnType<typeof deleteOrganisation>,
|
|
181
202
|
TError,
|
|
182
203
|
{ orgId: string },
|
|
183
204
|
TContext
|
|
@@ -188,43 +209,46 @@ export const useAppApiOrganisationDelete = <
|
|
|
188
209
|
|
|
189
210
|
* @summary Gets the (built-in) Default Organisation
|
|
190
211
|
*/
|
|
191
|
-
export const
|
|
192
|
-
options?:
|
|
193
|
-
)
|
|
194
|
-
return
|
|
212
|
+
export const getDefaultOrganisation = (
|
|
213
|
+
options?: SecondParameter<typeof customInstance>
|
|
214
|
+
) => {
|
|
215
|
+
return customInstance<OrganisationGetDefaultResponse>(
|
|
216
|
+
{ url: `/organisation/default`, method: "get" },
|
|
217
|
+
options
|
|
218
|
+
);
|
|
195
219
|
};
|
|
196
220
|
|
|
197
|
-
export const
|
|
221
|
+
export const getGetDefaultOrganisationQueryKey = () => [
|
|
198
222
|
`/organisation/default`,
|
|
199
223
|
];
|
|
200
224
|
|
|
201
|
-
export type
|
|
202
|
-
AsyncReturnType<typeof
|
|
225
|
+
export type GetDefaultOrganisationQueryResult = NonNullable<
|
|
226
|
+
AsyncReturnType<typeof getDefaultOrganisation>
|
|
203
227
|
>;
|
|
204
|
-
export type
|
|
228
|
+
export type GetDefaultOrganisationQueryError = ErrorType<void | AsError>;
|
|
205
229
|
|
|
206
|
-
export const
|
|
207
|
-
TData = AsyncReturnType<typeof
|
|
208
|
-
TError =
|
|
230
|
+
export const useGetDefaultOrganisation = <
|
|
231
|
+
TData = AsyncReturnType<typeof getDefaultOrganisation>,
|
|
232
|
+
TError = ErrorType<void | AsError>
|
|
209
233
|
>(options?: {
|
|
210
234
|
query?: UseQueryOptions<
|
|
211
|
-
AsyncReturnType<typeof
|
|
235
|
+
AsyncReturnType<typeof getDefaultOrganisation>,
|
|
212
236
|
TError,
|
|
213
237
|
TData
|
|
214
238
|
>;
|
|
215
|
-
|
|
239
|
+
request?: SecondParameter<typeof customInstance>;
|
|
216
240
|
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
217
|
-
const { query: queryOptions,
|
|
241
|
+
const { query: queryOptions, request: requestOptions } = options || {};
|
|
218
242
|
|
|
219
243
|
const queryKey =
|
|
220
|
-
queryOptions?.queryKey ??
|
|
244
|
+
queryOptions?.queryKey ?? getGetDefaultOrganisationQueryKey();
|
|
221
245
|
|
|
222
246
|
const queryFn: QueryFunction<
|
|
223
|
-
AsyncReturnType<typeof
|
|
224
|
-
> = () =>
|
|
247
|
+
AsyncReturnType<typeof getDefaultOrganisation>
|
|
248
|
+
> = () => getDefaultOrganisation(requestOptions);
|
|
225
249
|
|
|
226
250
|
const query = useQuery<
|
|
227
|
-
AsyncReturnType<typeof
|
|
251
|
+
AsyncReturnType<typeof getDefaultOrganisation>,
|
|
228
252
|
TError,
|
|
229
253
|
TData
|
|
230
254
|
>(queryKey, queryFn, queryOptions);
|