@go-avro/avro-js 0.0.2-beta.143 → 0.0.2-beta.144
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.
|
@@ -276,6 +276,9 @@ declare module '../client/QueryClient' {
|
|
|
276
276
|
breakId: string;
|
|
277
277
|
updates: Partial<Break>;
|
|
278
278
|
}>>;
|
|
279
|
+
useUpdateSelf(): ReturnType<typeof useMutation<{
|
|
280
|
+
msg: string;
|
|
281
|
+
}, StandardError, Partial<User>>>;
|
|
279
282
|
useDeleteJob(): ReturnType<typeof useMutation<{
|
|
280
283
|
msg: string;
|
|
281
284
|
}, StandardError, {
|
|
@@ -36,6 +36,31 @@ AvroQueryClient.prototype.useCreateSelf = function () {
|
|
|
36
36
|
},
|
|
37
37
|
});
|
|
38
38
|
};
|
|
39
|
+
AvroQueryClient.prototype.useUpdateSelf = function () {
|
|
40
|
+
const queryClient = this.getQueryClient();
|
|
41
|
+
return useMutation({
|
|
42
|
+
mutationFn: async (data) => {
|
|
43
|
+
return this.put(`/user`, JSON.stringify(data), undefined, { "Content-Type": "application/json" });
|
|
44
|
+
},
|
|
45
|
+
// Optimistically update the user data in the cache
|
|
46
|
+
onMutate: async (data) => {
|
|
47
|
+
await queryClient.cancelQueries({ queryKey: ['user'] });
|
|
48
|
+
const previousUser = queryClient.getQueryData(['user']);
|
|
49
|
+
if (previousUser) {
|
|
50
|
+
queryClient.setQueryData(['user'], { ...previousUser, ...data });
|
|
51
|
+
}
|
|
52
|
+
return { previousUser };
|
|
53
|
+
},
|
|
54
|
+
onError: (err, _, context) => {
|
|
55
|
+
if (context?.previousUser) {
|
|
56
|
+
queryClient.setQueryData(['user'], context.previousUser);
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
onSettled: () => {
|
|
60
|
+
queryClient.invalidateQueries({ queryKey: ['user'] });
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
};
|
|
39
64
|
AvroQueryClient.prototype.useUpdateUserCompany = function () {
|
|
40
65
|
const queryClient = this.getQueryClient();
|
|
41
66
|
return useMutation({
|
package/dist/types/api.d.ts
CHANGED
|
@@ -213,6 +213,7 @@ export interface User {
|
|
|
213
213
|
phone_number: string | null;
|
|
214
214
|
time_created: number;
|
|
215
215
|
time_updated: number | null;
|
|
216
|
+
share_location: boolean;
|
|
216
217
|
can_send_emails: boolean | null;
|
|
217
218
|
payment_methods: PaymentMethod[];
|
|
218
219
|
autopay_payment_types: string[];
|