@go-avro/avro-js 0.0.2-beta.125 → 0.0.2-beta.127
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.
|
@@ -84,10 +84,7 @@ declare module '../client/QueryClient' {
|
|
|
84
84
|
paid?: boolean;
|
|
85
85
|
}): UseInfiniteQueryResult<InfiniteData<Bill[], unknown>, StandardError>;
|
|
86
86
|
useGetPlans(code: string): UseQueryResult<Plan[], StandardError>;
|
|
87
|
-
useGetCompanies(options?: {}): UseQueryResult<
|
|
88
|
-
name: string;
|
|
89
|
-
id: string;
|
|
90
|
-
}[], StandardError>;
|
|
87
|
+
useGetCompanies(options?: {}): UseQueryResult<Company[], StandardError>;
|
|
91
88
|
useGetAnalytics(): UseQueryResult<any, StandardError>;
|
|
92
89
|
useFinanceAnalytics({ periods, cumulative }: {
|
|
93
90
|
periods: number[][];
|
|
@@ -244,7 +241,6 @@ declare module '../client/QueryClient' {
|
|
|
244
241
|
useRemoveUserCompany(): ReturnType<typeof useMutation<{
|
|
245
242
|
msg: string;
|
|
246
243
|
}, StandardError, {
|
|
247
|
-
companyId: string;
|
|
248
244
|
userId: string;
|
|
249
245
|
}>>;
|
|
250
246
|
useDeleteEvent(): ReturnType<typeof useMutation<{
|
|
@@ -81,13 +81,13 @@ AvroQueryClient.prototype.useUpdateCompany = function () {
|
|
|
81
81
|
AvroQueryClient.prototype.useRemoveUserCompany = function () {
|
|
82
82
|
const queryClient = this.getQueryClient();
|
|
83
83
|
return useMutation({
|
|
84
|
-
mutationFn: async ({
|
|
85
|
-
return this.delete(`/company/${companyId}/user/${userId}`);
|
|
84
|
+
mutationFn: async ({ userId }) => {
|
|
85
|
+
return this.delete(`/company/${this.companyId}/user/${userId}`);
|
|
86
86
|
},
|
|
87
|
-
onMutate: async ({
|
|
88
|
-
await queryClient.cancelQueries({ queryKey: ['company', companyId] });
|
|
89
|
-
const previousCompany = queryClient.getQueryData(['company', companyId]);
|
|
90
|
-
queryClient.setQueryData(['company', companyId], (oldData) => {
|
|
87
|
+
onMutate: async ({ userId }) => {
|
|
88
|
+
await queryClient.cancelQueries({ queryKey: ['company', this.companyId] });
|
|
89
|
+
const previousCompany = queryClient.getQueryData(['company', this.companyId]);
|
|
90
|
+
queryClient.setQueryData(['company', this.companyId], (oldData) => {
|
|
91
91
|
if (!oldData)
|
|
92
92
|
return oldData;
|
|
93
93
|
return {
|
|
@@ -98,14 +98,12 @@ AvroQueryClient.prototype.useRemoveUserCompany = function () {
|
|
|
98
98
|
return { previousCompany };
|
|
99
99
|
},
|
|
100
100
|
onError: (err, variables, context) => {
|
|
101
|
-
const { companyId } = variables;
|
|
102
101
|
if (context?.previousCompany) {
|
|
103
|
-
queryClient.setQueryData(['company', companyId], context.previousCompany);
|
|
102
|
+
queryClient.setQueryData(['company', this.companyId], context.previousCompany);
|
|
104
103
|
}
|
|
105
104
|
},
|
|
106
105
|
onSettled: (_data, _error, variables) => {
|
|
107
|
-
|
|
108
|
-
queryClient.invalidateQueries({ queryKey: ['company', companyId] });
|
|
106
|
+
queryClient.invalidateQueries({ queryKey: ['company', this.companyId] });
|
|
109
107
|
},
|
|
110
108
|
});
|
|
111
109
|
};
|