@go-avro/avro-js 0.0.31 → 0.0.33
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/dist/client/QueryClient.js +39 -5
- package/dist/client/hooks/bills.js +0 -23
- package/dist/client/hooks/catalog_items.js +0 -10
- package/dist/client/hooks/companies.js +0 -20
- package/dist/client/hooks/events.js +0 -17
- package/dist/client/hooks/groups.js +0 -14
- package/dist/client/hooks/jobs.js +0 -21
- package/dist/client/hooks/labels.js +0 -14
- package/dist/client/hooks/messages.js +0 -4
- package/dist/client/hooks/months.js +0 -4
- package/dist/client/hooks/prepayments.js +0 -4
- package/dist/client/hooks/routes.js +0 -15
- package/dist/client/hooks/sessions.js +0 -12
- package/dist/client/hooks/skills.js +0 -11
- package/dist/client/hooks/teams.js +0 -12
- package/dist/client/hooks/timecards.js +0 -6
- package/dist/client/hooks/users.js +0 -20
- package/dist/client/hooks/waivers.js +0 -11
- package/package.json +1 -1
|
@@ -34,10 +34,10 @@ const SOCKET_EVENT_CONFIG = {
|
|
|
34
34
|
create_route: { entityKey: 'routes', action: 'create', fetchPath: (id) => `/route/${id}` },
|
|
35
35
|
update_route: { entityKey: 'routes', action: 'update', fetchPath: (id) => `/route/${id}` },
|
|
36
36
|
delete_route: { entityKey: 'routes', action: 'delete', fetchPath: null },
|
|
37
|
-
// ── Events ──
|
|
38
|
-
create_event: { entityKey: 'events', action: 'create', fetchPath: (id) => `/event/${id}` },
|
|
39
|
-
update_event: { entityKey: 'events', action: 'update', fetchPath: (id) => `/event/${id}` },
|
|
40
|
-
delete_event: { entityKey: 'events', action: 'delete', fetchPath: null },
|
|
37
|
+
// ── Events (also refetch parent job — overdueness, last_event, etc.) ──
|
|
38
|
+
create_event: { entityKey: 'events', action: 'create', fetchPath: (id) => `/event/${id}`, relatedRefetch: [{ entityKey: 'jobs', idField: 'job_id', fetchPath: (id) => `/job/${id}` }] },
|
|
39
|
+
update_event: { entityKey: 'events', action: 'update', fetchPath: (id) => `/event/${id}`, relatedRefetch: [{ entityKey: 'jobs', idField: 'job_id', fetchPath: (id) => `/job/${id}` }] },
|
|
40
|
+
delete_event: { entityKey: 'events', action: 'delete', fetchPath: null, relatedRefetch: [{ entityKey: 'jobs', idField: 'job_id', fetchPath: (id) => `/job/${id}` }] },
|
|
41
41
|
update_events: { invalidateKeys: [['events']] },
|
|
42
42
|
// ── Teams ──
|
|
43
43
|
create_team: { entityKey: 'teams', action: 'create', fetchPath: null },
|
|
@@ -205,7 +205,7 @@ export class AvroQueryClient {
|
|
|
205
205
|
}
|
|
206
206
|
else {
|
|
207
207
|
// ── Targeted: surgical cache update ──────────────────
|
|
208
|
-
const { entityKey, action, fetchPath, idField, alsoInvalidate } = config;
|
|
208
|
+
const { entityKey, action, fetchPath, idField, alsoInvalidate, relatedRefetch } = config;
|
|
209
209
|
const handler = async (data) => {
|
|
210
210
|
const id = data?.[idField ?? 'id'];
|
|
211
211
|
// No id → old backend or malformed payload → full invalidation
|
|
@@ -319,6 +319,40 @@ export class AvroQueryClient {
|
|
|
319
319
|
}
|
|
320
320
|
// Invalidate any additional keys (e.g. companies → /company/list)
|
|
321
321
|
alsoInvalidate?.forEach((k) => queryClient.invalidateQueries({ queryKey: k }));
|
|
322
|
+
// Refetch & patch related entities (e.g. event → parent job)
|
|
323
|
+
if (relatedRefetch) {
|
|
324
|
+
for (const related of relatedRefetch) {
|
|
325
|
+
const relatedId = data?.[related.idField];
|
|
326
|
+
if (!relatedId || typeof relatedId !== 'string')
|
|
327
|
+
continue;
|
|
328
|
+
try {
|
|
329
|
+
const item = await queryClient.fetchQuery({
|
|
330
|
+
queryKey: [related.entityKey, relatedId],
|
|
331
|
+
queryFn: () => client.get({ path: related.fetchPath(relatedId) }),
|
|
332
|
+
staleTime: 0,
|
|
333
|
+
});
|
|
334
|
+
const relatedPredicate = (q) => matchesEntityKey(q, related.entityKey);
|
|
335
|
+
queryClient.setQueriesData({ predicate: relatedPredicate, type: 'active' }, (old) => {
|
|
336
|
+
if (!old)
|
|
337
|
+
return old;
|
|
338
|
+
if (old.pages && Array.isArray(old.pages)) {
|
|
339
|
+
return {
|
|
340
|
+
...old,
|
|
341
|
+
pages: old.pages.map((page) => page.map((x) => (x?.id === relatedId ? item : x))),
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
if (Array.isArray(old)) {
|
|
345
|
+
return old.map((x) => (x?.id === relatedId ? item : x));
|
|
346
|
+
}
|
|
347
|
+
return old;
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
catch {
|
|
351
|
+
// Fetch failed → invalidate related entity lists
|
|
352
|
+
invalidateEntity(related.entityKey);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
322
356
|
};
|
|
323
357
|
this.socket.on(event, handler);
|
|
324
358
|
handlers.push({ event, handler });
|
|
@@ -68,12 +68,6 @@ AvroQueryClient.prototype.useCreateBill = function () {
|
|
|
68
68
|
queryClient.setQueryData(['bills'], context.previousBills);
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
|
-
onSettled: (_data, _error) => {
|
|
72
|
-
queryClient.invalidateQueries({ queryKey: ['bills', this.companyId] });
|
|
73
|
-
queryClient.invalidateQueries({ queryKey: ['events', this.companyId] });
|
|
74
|
-
queryClient.invalidateQueries({ queryKey: ['months', this.companyId] });
|
|
75
|
-
queryClient.invalidateQueries({ queryKey: ['companies'] });
|
|
76
|
-
},
|
|
77
71
|
});
|
|
78
72
|
};
|
|
79
73
|
AvroQueryClient.prototype.useUpdateBill = function () {
|
|
@@ -119,10 +113,6 @@ AvroQueryClient.prototype.useUpdateBill = function () {
|
|
|
119
113
|
queryClient.setQueryData(['bills', billId], context.previousBill);
|
|
120
114
|
}
|
|
121
115
|
},
|
|
122
|
-
onSettled: (data, error, variables) => {
|
|
123
|
-
const { billId } = variables;
|
|
124
|
-
queryClient.invalidateQueries({ queryKey: ['bills'] });
|
|
125
|
-
},
|
|
126
116
|
});
|
|
127
117
|
};
|
|
128
118
|
AvroQueryClient.prototype.useDeleteBill = function () {
|
|
@@ -142,11 +132,6 @@ AvroQueryClient.prototype.useDeleteBill = function () {
|
|
|
142
132
|
queryClient.setQueryData(['bills'], context.previousBills);
|
|
143
133
|
}
|
|
144
134
|
},
|
|
145
|
-
onSettled: (_data, _error) => {
|
|
146
|
-
queryClient.invalidateQueries({ queryKey: ['bills'] });
|
|
147
|
-
queryClient.invalidateQueries({ queryKey: ['events'] });
|
|
148
|
-
queryClient.invalidateQueries({ queryKey: ['months'] });
|
|
149
|
-
},
|
|
150
135
|
});
|
|
151
136
|
};
|
|
152
137
|
AvroQueryClient.prototype.useSyncBillToIntuit = function () {
|
|
@@ -168,10 +153,6 @@ AvroQueryClient.prototype.useSyncBillToIntuit = function () {
|
|
|
168
153
|
queryClient.setQueryData(['bills', billId], context.previousBill);
|
|
169
154
|
}
|
|
170
155
|
},
|
|
171
|
-
onSettled: (_data, _error, variables) => {
|
|
172
|
-
const { billId } = variables;
|
|
173
|
-
queryClient.invalidateQueries({ queryKey: ['bills', billId] });
|
|
174
|
-
},
|
|
175
156
|
});
|
|
176
157
|
};
|
|
177
158
|
AvroQueryClient.prototype.useImportBillsFromIntuit = function () {
|
|
@@ -182,10 +163,6 @@ AvroQueryClient.prototype.useImportBillsFromIntuit = function () {
|
|
|
182
163
|
path: `/company/${this.companyId}/intuit/import`,
|
|
183
164
|
});
|
|
184
165
|
},
|
|
185
|
-
onSettled: () => {
|
|
186
|
-
queryClient.invalidateQueries({ queryKey: ['bills', this.companyId] });
|
|
187
|
-
queryClient.invalidateQueries({ queryKey: ['companies', 'current'] });
|
|
188
|
-
},
|
|
189
166
|
});
|
|
190
167
|
};
|
|
191
168
|
AvroQueryClient.prototype.generatePDFFromBackend = function ({ billId }) {
|
|
@@ -22,9 +22,6 @@ AvroQueryClient.prototype.useCreateCatalogItem = function () {
|
|
|
22
22
|
queryClient.setQueryData(['catalog_items', this.companyId], context.previousItems);
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
|
-
onSettled: () => {
|
|
26
|
-
queryClient.invalidateQueries({ queryKey: ['catalog_items', this.companyId] });
|
|
27
|
-
},
|
|
28
25
|
});
|
|
29
26
|
};
|
|
30
27
|
AvroQueryClient.prototype.useUpdateCatalogItem = function () {
|
|
@@ -70,10 +67,6 @@ AvroQueryClient.prototype.useUpdateCatalogItem = function () {
|
|
|
70
67
|
queryClient.setQueryData(['catalog_items', catalogItemId], context.previousItem);
|
|
71
68
|
}
|
|
72
69
|
},
|
|
73
|
-
onSettled: (_data, _error, variables) => {
|
|
74
|
-
const { catalogItemId } = variables;
|
|
75
|
-
queryClient.invalidateQueries({ queryKey: ['catalog_items'] });
|
|
76
|
-
},
|
|
77
70
|
});
|
|
78
71
|
};
|
|
79
72
|
AvroQueryClient.prototype.useGetCatalogItem = function (catalogItemId) {
|
|
@@ -99,8 +92,5 @@ AvroQueryClient.prototype.useDeleteCatalogItem = function () {
|
|
|
99
92
|
queryClient.setQueryData(['catalog_items'], context.previousItems);
|
|
100
93
|
}
|
|
101
94
|
},
|
|
102
|
-
onSettled: (_data, _error) => {
|
|
103
|
-
queryClient.invalidateQueries({ queryKey: ['catalog_items'] });
|
|
104
|
-
},
|
|
105
95
|
});
|
|
106
96
|
};
|
|
@@ -56,9 +56,6 @@ AvroQueryClient.prototype.useCreateCompany = function () {
|
|
|
56
56
|
headers: { "Content-Type": "application/json" }
|
|
57
57
|
});
|
|
58
58
|
},
|
|
59
|
-
onSettled: () => {
|
|
60
|
-
queryClient.invalidateQueries({ queryKey: ['/company/list'] });
|
|
61
|
-
},
|
|
62
59
|
});
|
|
63
60
|
};
|
|
64
61
|
AvroQueryClient.prototype.useUpdateCompany = function () {
|
|
@@ -93,11 +90,6 @@ AvroQueryClient.prototype.useUpdateCompany = function () {
|
|
|
93
90
|
queryClient.setQueryData(['/company/list'], context.previousCompanyList);
|
|
94
91
|
}
|
|
95
92
|
},
|
|
96
|
-
onSettled: (_data, _error, variables) => {
|
|
97
|
-
const { companyId } = variables;
|
|
98
|
-
queryClient.invalidateQueries({ queryKey: ['companies', companyId] });
|
|
99
|
-
queryClient.invalidateQueries({ queryKey: ['/company/list'] });
|
|
100
|
-
},
|
|
101
93
|
});
|
|
102
94
|
};
|
|
103
95
|
AvroQueryClient.prototype.useCreateUserCompany = function () {
|
|
@@ -131,11 +123,6 @@ AvroQueryClient.prototype.useCreateUserCompany = function () {
|
|
|
131
123
|
queryClient.setQueryData(['companies', this.companyId], context.previousCompany);
|
|
132
124
|
}
|
|
133
125
|
},
|
|
134
|
-
onSettled: (_data, _error, variables) => {
|
|
135
|
-
queryClient.invalidateQueries({ queryKey: ['companies', this.companyId] });
|
|
136
|
-
queryClient.invalidateQueries({ queryKey: ['/company/list'] });
|
|
137
|
-
queryClient.invalidateQueries({ queryKey: ['companies', 'current'] });
|
|
138
|
-
},
|
|
139
126
|
});
|
|
140
127
|
};
|
|
141
128
|
AvroQueryClient.prototype.useRemoveUserCompany = function () {
|
|
@@ -164,9 +151,6 @@ AvroQueryClient.prototype.useRemoveUserCompany = function () {
|
|
|
164
151
|
queryClient.setQueryData(['companies', this.companyId], context.previousCompany);
|
|
165
152
|
}
|
|
166
153
|
},
|
|
167
|
-
onSettled: (_data, _error, variables) => {
|
|
168
|
-
queryClient.invalidateQueries({ queryKey: ['companies', this.companyId] });
|
|
169
|
-
},
|
|
170
154
|
});
|
|
171
155
|
};
|
|
172
156
|
AvroQueryClient.prototype.useDeleteCompany = function () {
|
|
@@ -193,9 +177,5 @@ AvroQueryClient.prototype.useDeleteCompany = function () {
|
|
|
193
177
|
queryClient.setQueryData(['/company/list'], context.previousCompanyList);
|
|
194
178
|
}
|
|
195
179
|
},
|
|
196
|
-
onSettled: (_data, _error, companyId) => {
|
|
197
|
-
queryClient.invalidateQueries({ queryKey: ['/company/list'] });
|
|
198
|
-
queryClient.invalidateQueries({ queryKey: ['companies', companyId] });
|
|
199
|
-
},
|
|
200
180
|
});
|
|
201
181
|
};
|
|
@@ -119,11 +119,6 @@ AvroQueryClient.prototype.useCreateEvent = function () {
|
|
|
119
119
|
queryClient.setQueryData(['jobs'], context.previousJobs);
|
|
120
120
|
}
|
|
121
121
|
},
|
|
122
|
-
onSettled: () => {
|
|
123
|
-
queryClient.invalidateQueries({ queryKey: ['events'] });
|
|
124
|
-
queryClient.invalidateQueries({ queryKey: ['jobs'] });
|
|
125
|
-
queryClient.invalidateQueries({ queryKey: ['companies'] });
|
|
126
|
-
},
|
|
127
122
|
});
|
|
128
123
|
};
|
|
129
124
|
AvroQueryClient.prototype.useUpdateEvent = function () {
|
|
@@ -194,11 +189,6 @@ AvroQueryClient.prototype.useUpdateEvent = function () {
|
|
|
194
189
|
queryClient.setQueryData(['jobs'], context.previousJobs);
|
|
195
190
|
}
|
|
196
191
|
},
|
|
197
|
-
onSettled: (_data, _error, variables) => {
|
|
198
|
-
const { eventId } = variables;
|
|
199
|
-
queryClient.invalidateQueries({ queryKey: ['events'] });
|
|
200
|
-
queryClient.invalidateQueries({ queryKey: ['jobs'] });
|
|
201
|
-
},
|
|
202
192
|
});
|
|
203
193
|
};
|
|
204
194
|
AvroQueryClient.prototype.useUpdateEvents = function () {
|
|
@@ -259,9 +249,6 @@ AvroQueryClient.prototype.useUpdateEvents = function () {
|
|
|
259
249
|
});
|
|
260
250
|
}
|
|
261
251
|
},
|
|
262
|
-
onSettled: () => {
|
|
263
|
-
queryClient.invalidateQueries({ queryKey: ['events'] });
|
|
264
|
-
},
|
|
265
252
|
});
|
|
266
253
|
};
|
|
267
254
|
AvroQueryClient.prototype.useDeleteEvent = function () {
|
|
@@ -302,9 +289,5 @@ AvroQueryClient.prototype.useDeleteEvent = function () {
|
|
|
302
289
|
queryClient.setQueryData(['events', eventId], context.previousEvent);
|
|
303
290
|
}
|
|
304
291
|
},
|
|
305
|
-
onSettled: (_data, _error, variables) => {
|
|
306
|
-
const { eventId } = variables;
|
|
307
|
-
queryClient.invalidateQueries({ queryKey: ['events'] });
|
|
308
|
-
},
|
|
309
292
|
});
|
|
310
293
|
};
|
|
@@ -36,10 +36,6 @@ AvroQueryClient.prototype.useCreateGroup = function () {
|
|
|
36
36
|
headers: { "Content-Type": "application/json" }
|
|
37
37
|
});
|
|
38
38
|
},
|
|
39
|
-
onSettled: () => {
|
|
40
|
-
queryClient.invalidateQueries({ queryKey: ['companies'] });
|
|
41
|
-
queryClient.invalidateQueries({ queryKey: ['groups'] });
|
|
42
|
-
},
|
|
43
39
|
});
|
|
44
40
|
};
|
|
45
41
|
AvroQueryClient.prototype.useUpdateGroup = function () {
|
|
@@ -85,11 +81,6 @@ AvroQueryClient.prototype.useUpdateGroup = function () {
|
|
|
85
81
|
queryClient.setQueryData(['groups', groupId], context.previousGroup);
|
|
86
82
|
}
|
|
87
83
|
},
|
|
88
|
-
onSettled: (_data, _error, variables) => {
|
|
89
|
-
const { groupId } = variables;
|
|
90
|
-
queryClient.invalidateQueries({ queryKey: ['groups'] });
|
|
91
|
-
queryClient.invalidateQueries({ queryKey: ['companies'] });
|
|
92
|
-
},
|
|
93
84
|
});
|
|
94
85
|
};
|
|
95
86
|
AvroQueryClient.prototype.useDeleteGroup = function () {
|
|
@@ -129,10 +120,5 @@ AvroQueryClient.prototype.useDeleteGroup = function () {
|
|
|
129
120
|
queryClient.setQueryData(['groups', groupId], context.previousGroup);
|
|
130
121
|
}
|
|
131
122
|
},
|
|
132
|
-
onSettled: (_data, _error, variables) => {
|
|
133
|
-
const { groupId } = variables;
|
|
134
|
-
queryClient.invalidateQueries({ queryKey: ['groups'] });
|
|
135
|
-
queryClient.invalidateQueries({ queryKey: ['companies'] });
|
|
136
|
-
},
|
|
137
123
|
});
|
|
138
124
|
};
|
|
@@ -91,11 +91,6 @@ AvroQueryClient.prototype.useCreateJob = function () {
|
|
|
91
91
|
headers: { "Content-Type": "application/json" }
|
|
92
92
|
});
|
|
93
93
|
},
|
|
94
|
-
onSettled: (data) => {
|
|
95
|
-
const { id: jobId } = data ?? {};
|
|
96
|
-
queryClient.invalidateQueries({ queryKey: ['jobs'] });
|
|
97
|
-
queryClient.invalidateQueries({ queryKey: ['companies'] });
|
|
98
|
-
},
|
|
99
94
|
});
|
|
100
95
|
};
|
|
101
96
|
AvroQueryClient.prototype.useManageJobs = function () {
|
|
@@ -108,9 +103,6 @@ AvroQueryClient.prototype.useManageJobs = function () {
|
|
|
108
103
|
headers: { "Content-Type": "application/json" }
|
|
109
104
|
});
|
|
110
105
|
},
|
|
111
|
-
onSettled: (_data, _error, _variables) => {
|
|
112
|
-
queryClient.invalidateQueries({ queryKey: ['jobs'] });
|
|
113
|
-
},
|
|
114
106
|
});
|
|
115
107
|
};
|
|
116
108
|
AvroQueryClient.prototype.useUpdateJob = function () {
|
|
@@ -123,10 +115,6 @@ AvroQueryClient.prototype.useUpdateJob = function () {
|
|
|
123
115
|
headers: { "Content-Type": "application/json" }
|
|
124
116
|
});
|
|
125
117
|
},
|
|
126
|
-
onSettled: (data, error, variables) => {
|
|
127
|
-
const { jobId } = variables;
|
|
128
|
-
queryClient.invalidateQueries({ queryKey: ['jobs'] });
|
|
129
|
-
},
|
|
130
118
|
});
|
|
131
119
|
};
|
|
132
120
|
AvroQueryClient.prototype.useDeleteJobs = function () {
|
|
@@ -139,10 +127,6 @@ AvroQueryClient.prototype.useDeleteJobs = function () {
|
|
|
139
127
|
headers: { "Content-Type": "application/json" }
|
|
140
128
|
});
|
|
141
129
|
},
|
|
142
|
-
onSettled: (_data, _error, _variables) => {
|
|
143
|
-
queryClient.invalidateQueries({ queryKey: ['jobs'] });
|
|
144
|
-
queryClient.invalidateQueries({ queryKey: ['routes'] });
|
|
145
|
-
},
|
|
146
130
|
});
|
|
147
131
|
};
|
|
148
132
|
AvroQueryClient.prototype.useDeleteJob = function () {
|
|
@@ -156,10 +140,5 @@ AvroQueryClient.prototype.useDeleteJob = function () {
|
|
|
156
140
|
}
|
|
157
141
|
});
|
|
158
142
|
},
|
|
159
|
-
onSettled: (_data, _error, variables) => {
|
|
160
|
-
const { jobId } = variables;
|
|
161
|
-
queryClient.invalidateQueries({ queryKey: ['jobs'] });
|
|
162
|
-
queryClient.invalidateQueries({ queryKey: ['routes'] });
|
|
163
|
-
},
|
|
164
143
|
});
|
|
165
144
|
};
|
|
@@ -36,10 +36,6 @@ AvroQueryClient.prototype.useCreateLabel = function () {
|
|
|
36
36
|
headers: { "Content-Type": "application/json" }
|
|
37
37
|
});
|
|
38
38
|
},
|
|
39
|
-
onSettled: () => {
|
|
40
|
-
queryClient.invalidateQueries({ queryKey: ['companies'] });
|
|
41
|
-
queryClient.invalidateQueries({ queryKey: ['labels'] });
|
|
42
|
-
},
|
|
43
39
|
});
|
|
44
40
|
};
|
|
45
41
|
AvroQueryClient.prototype.useUpdateLabel = function () {
|
|
@@ -85,11 +81,6 @@ AvroQueryClient.prototype.useUpdateLabel = function () {
|
|
|
85
81
|
queryClient.setQueryData(['labels', labelId], context.previousLabel);
|
|
86
82
|
}
|
|
87
83
|
},
|
|
88
|
-
onSettled: (_data, _error, variables) => {
|
|
89
|
-
const { labelId } = variables;
|
|
90
|
-
queryClient.invalidateQueries({ queryKey: ['labels'] });
|
|
91
|
-
queryClient.invalidateQueries({ queryKey: ['companies'] });
|
|
92
|
-
},
|
|
93
84
|
});
|
|
94
85
|
};
|
|
95
86
|
AvroQueryClient.prototype.useDeleteLabel = function () {
|
|
@@ -127,10 +118,5 @@ AvroQueryClient.prototype.useDeleteLabel = function () {
|
|
|
127
118
|
queryClient.setQueryData(['labels', labelId], context.previousLabel);
|
|
128
119
|
}
|
|
129
120
|
},
|
|
130
|
-
onSettled: (_data, _error, variables) => {
|
|
131
|
-
const { labelId } = variables;
|
|
132
|
-
queryClient.invalidateQueries({ queryKey: ['labels'] });
|
|
133
|
-
queryClient.invalidateQueries({ queryKey: ['companies'] });
|
|
134
|
-
},
|
|
135
121
|
});
|
|
136
122
|
};
|
|
@@ -48,9 +48,5 @@ AvroQueryClient.prototype.useCreateMessage = function (chatId) {
|
|
|
48
48
|
onSuccess: (message) => {
|
|
49
49
|
queryClient.setQueryData(['message', message.id], message);
|
|
50
50
|
},
|
|
51
|
-
onSettled: () => {
|
|
52
|
-
queryClient.invalidateQueries({ queryKey: ['messages', chatId] });
|
|
53
|
-
queryClient.invalidateQueries({ queryKey: ['chats'] });
|
|
54
|
-
},
|
|
55
51
|
});
|
|
56
52
|
};
|
|
@@ -76,11 +76,6 @@ AvroQueryClient.prototype.useCreateRoute = function () {
|
|
|
76
76
|
queryClient.setQueryData(['routes'], context.previousRoutes);
|
|
77
77
|
}
|
|
78
78
|
},
|
|
79
|
-
onSettled: (_data, _error, _variables) => {
|
|
80
|
-
queryClient.invalidateQueries({ queryKey: ['routes'] });
|
|
81
|
-
queryClient.invalidateQueries({ queryKey: ['jobs'] });
|
|
82
|
-
queryClient.invalidateQueries({ queryKey: ['companies'] });
|
|
83
|
-
},
|
|
84
79
|
});
|
|
85
80
|
};
|
|
86
81
|
AvroQueryClient.prototype.useScheduleRoutes = function () {
|
|
@@ -135,11 +130,6 @@ AvroQueryClient.prototype.useUpdateRoute = function () {
|
|
|
135
130
|
queryClient.setQueryData(['routes'], context.previousRoutes);
|
|
136
131
|
}
|
|
137
132
|
},
|
|
138
|
-
onSettled: (_data, _error, variables) => {
|
|
139
|
-
const { routeId } = variables;
|
|
140
|
-
queryClient.invalidateQueries({ queryKey: ['routes'] });
|
|
141
|
-
queryClient.invalidateQueries({ queryKey: ['jobs'] });
|
|
142
|
-
},
|
|
143
133
|
});
|
|
144
134
|
};
|
|
145
135
|
AvroQueryClient.prototype.useDeleteRoute = function () {
|
|
@@ -177,10 +167,5 @@ AvroQueryClient.prototype.useDeleteRoute = function () {
|
|
|
177
167
|
queryClient.setQueryData(['routes', routeId], context.previousRoute);
|
|
178
168
|
}
|
|
179
169
|
},
|
|
180
|
-
onSettled: (_data, _error, variables) => {
|
|
181
|
-
const { routeId } = variables;
|
|
182
|
-
queryClient.invalidateQueries({ queryKey: ['routes'] });
|
|
183
|
-
queryClient.invalidateQueries({ queryKey: ['jobs'] });
|
|
184
|
-
},
|
|
185
170
|
});
|
|
186
171
|
};
|
|
@@ -42,9 +42,6 @@ AvroQueryClient.prototype.useCreateUserSession = function () {
|
|
|
42
42
|
queryClient.setQueryData(['sessions', this.companyId], context.previousSessions);
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
|
-
onSettled: () => {
|
|
46
|
-
queryClient.invalidateQueries({ queryKey: ['sessions', this.companyId] });
|
|
47
|
-
},
|
|
48
45
|
});
|
|
49
46
|
};
|
|
50
47
|
AvroQueryClient.prototype.useCreateSessionBreak = function () {
|
|
@@ -87,9 +84,6 @@ AvroQueryClient.prototype.useCreateSessionBreak = function () {
|
|
|
87
84
|
queryClient.setQueryData(['sessions', this.companyId], context.previousSessions);
|
|
88
85
|
}
|
|
89
86
|
},
|
|
90
|
-
onSettled: () => {
|
|
91
|
-
queryClient.invalidateQueries({ queryKey: ['sessions', this.companyId] });
|
|
92
|
-
},
|
|
93
87
|
});
|
|
94
88
|
};
|
|
95
89
|
AvroQueryClient.prototype.useUpdateUserSession = function () {
|
|
@@ -120,9 +114,6 @@ AvroQueryClient.prototype.useUpdateUserSession = function () {
|
|
|
120
114
|
queryClient.setQueryData(['sessions', this.companyId], context.previousSessions);
|
|
121
115
|
}
|
|
122
116
|
},
|
|
123
|
-
onSettled: () => {
|
|
124
|
-
queryClient.invalidateQueries({ queryKey: ['sessions', this.companyId] });
|
|
125
|
-
},
|
|
126
117
|
});
|
|
127
118
|
};
|
|
128
119
|
AvroQueryClient.prototype.useUpdateSessionBreak = function () {
|
|
@@ -156,9 +147,6 @@ AvroQueryClient.prototype.useUpdateSessionBreak = function () {
|
|
|
156
147
|
queryClient.setQueryData(['sessions', this.companyId], context.previousSessions);
|
|
157
148
|
}
|
|
158
149
|
},
|
|
159
|
-
onSettled: () => {
|
|
160
|
-
queryClient.invalidateQueries({ queryKey: ['sessions', this.companyId] });
|
|
161
|
-
},
|
|
162
150
|
});
|
|
163
151
|
};
|
|
164
152
|
AvroQueryClient.prototype.useGetSessions = function (body) {
|
|
@@ -10,10 +10,6 @@ AvroQueryClient.prototype.useCreateSkill = function () {
|
|
|
10
10
|
headers: { "Content-Type": "application/json" }
|
|
11
11
|
});
|
|
12
12
|
},
|
|
13
|
-
onSettled: () => {
|
|
14
|
-
queryClient.invalidateQueries({ queryKey: ['companies'] });
|
|
15
|
-
queryClient.invalidateQueries({ queryKey: ['skills'] });
|
|
16
|
-
},
|
|
17
13
|
});
|
|
18
14
|
};
|
|
19
15
|
AvroQueryClient.prototype.useGetSkills = function (body, total, onProgress) {
|
|
@@ -85,10 +81,6 @@ AvroQueryClient.prototype.useUpdateSkill = function () {
|
|
|
85
81
|
queryClient.setQueryData(['skills', skillId], context.previousSkill);
|
|
86
82
|
}
|
|
87
83
|
},
|
|
88
|
-
onSettled: (_data, _error, variables) => {
|
|
89
|
-
const { skillId } = variables;
|
|
90
|
-
queryClient.invalidateQueries({ queryKey: ['skills'] });
|
|
91
|
-
},
|
|
92
84
|
});
|
|
93
85
|
};
|
|
94
86
|
AvroQueryClient.prototype.useDeleteSkill = function () {
|
|
@@ -119,8 +111,5 @@ AvroQueryClient.prototype.useDeleteSkill = function () {
|
|
|
119
111
|
queryClient.setQueryData(['skills'], context.previousSkills);
|
|
120
112
|
}
|
|
121
113
|
},
|
|
122
|
-
onSettled: () => {
|
|
123
|
-
queryClient.invalidateQueries({ queryKey: ['skills'] });
|
|
124
|
-
},
|
|
125
114
|
});
|
|
126
115
|
};
|
|
@@ -36,10 +36,6 @@ AvroQueryClient.prototype.useCreateTeam = function () {
|
|
|
36
36
|
headers: { "Content-Type": "application/json" }
|
|
37
37
|
});
|
|
38
38
|
},
|
|
39
|
-
onSettled: () => {
|
|
40
|
-
queryClient.invalidateQueries({ queryKey: ['companies'] });
|
|
41
|
-
queryClient.invalidateQueries({ queryKey: ['teams'] });
|
|
42
|
-
},
|
|
43
39
|
});
|
|
44
40
|
};
|
|
45
41
|
AvroQueryClient.prototype.useUpdateTeam = function () {
|
|
@@ -85,10 +81,6 @@ AvroQueryClient.prototype.useUpdateTeam = function () {
|
|
|
85
81
|
queryClient.setQueryData(['teams', teamId], context.previousTeam);
|
|
86
82
|
}
|
|
87
83
|
},
|
|
88
|
-
onSettled: (_data, _error, variables) => {
|
|
89
|
-
const { teamId } = variables;
|
|
90
|
-
queryClient.invalidateQueries({ queryKey: ['teams'] });
|
|
91
|
-
},
|
|
92
84
|
});
|
|
93
85
|
};
|
|
94
86
|
AvroQueryClient.prototype.useDeleteTeam = function () {
|
|
@@ -126,9 +118,5 @@ AvroQueryClient.prototype.useDeleteTeam = function () {
|
|
|
126
118
|
queryClient.setQueryData(['teams', teamId], context.previousRoute);
|
|
127
119
|
}
|
|
128
120
|
},
|
|
129
|
-
onSettled: (_data, _error, variables) => {
|
|
130
|
-
const { teamId } = variables;
|
|
131
|
-
queryClient.invalidateQueries({ queryKey: ['teams'] });
|
|
132
|
-
},
|
|
133
121
|
});
|
|
134
122
|
};
|
|
@@ -53,9 +53,6 @@ AvroQueryClient.prototype.useCreateTimecard = function () {
|
|
|
53
53
|
headers: { "Content-Type": "application/json" },
|
|
54
54
|
});
|
|
55
55
|
},
|
|
56
|
-
onSettled: async () => {
|
|
57
|
-
await queryClient.invalidateQueries({ queryKey: ["timecards"] });
|
|
58
|
-
},
|
|
59
56
|
});
|
|
60
57
|
};
|
|
61
58
|
AvroQueryClient.prototype.useUpdateTimecard = function () {
|
|
@@ -68,8 +65,5 @@ AvroQueryClient.prototype.useUpdateTimecard = function () {
|
|
|
68
65
|
headers: { "Content-Type": "application/json" },
|
|
69
66
|
});
|
|
70
67
|
},
|
|
71
|
-
onSettled: async (_data, _err, variables) => {
|
|
72
|
-
await queryClient.invalidateQueries({ queryKey: ["timecards"] });
|
|
73
|
-
},
|
|
74
68
|
});
|
|
75
69
|
};
|
|
@@ -36,12 +36,6 @@ AvroQueryClient.prototype.useCreateSelf = function () {
|
|
|
36
36
|
headers: { "Content-Type": "application/json" }
|
|
37
37
|
});
|
|
38
38
|
},
|
|
39
|
-
onSettled: (data) => {
|
|
40
|
-
queryClient.invalidateQueries({ queryKey: ['user'] });
|
|
41
|
-
if (data?.access_token && data?.refresh_token) {
|
|
42
|
-
return this.loginSuccess({ access_token: data.access_token, refresh_token: data.refresh_token });
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
39
|
});
|
|
46
40
|
};
|
|
47
41
|
AvroQueryClient.prototype.useCreateUser = function () {
|
|
@@ -54,9 +48,6 @@ AvroQueryClient.prototype.useCreateUser = function () {
|
|
|
54
48
|
headers: { "Content-Type": "application/json" }
|
|
55
49
|
});
|
|
56
50
|
},
|
|
57
|
-
onSettled: (data) => {
|
|
58
|
-
queryClient.invalidateQueries({ queryKey: ['user'] });
|
|
59
|
-
},
|
|
60
51
|
});
|
|
61
52
|
};
|
|
62
53
|
AvroQueryClient.prototype.useUpdateUser = function (userId) {
|
|
@@ -91,10 +82,6 @@ AvroQueryClient.prototype.useUpdateUser = function (userId) {
|
|
|
91
82
|
queryClient.setQueryData(['users', userId], context.previousUser);
|
|
92
83
|
}
|
|
93
84
|
},
|
|
94
|
-
onSettled: () => {
|
|
95
|
-
queryClient.invalidateQueries({ queryKey: ['user'] });
|
|
96
|
-
queryClient.invalidateQueries({ queryKey: ['users', userId] });
|
|
97
|
-
},
|
|
98
85
|
});
|
|
99
86
|
};
|
|
100
87
|
AvroQueryClient.prototype.useUpdateUserCompany = function () {
|
|
@@ -127,10 +114,6 @@ AvroQueryClient.prototype.useUpdateUserCompany = function () {
|
|
|
127
114
|
queryClient.setQueryData(['companies', this.companyId], context.previousCompany);
|
|
128
115
|
}
|
|
129
116
|
},
|
|
130
|
-
onSettled: (data, error, variables) => {
|
|
131
|
-
queryClient.invalidateQueries({ queryKey: ['user'] });
|
|
132
|
-
queryClient.invalidateQueries({ queryKey: ['companies', this.companyId] });
|
|
133
|
-
},
|
|
134
117
|
});
|
|
135
118
|
};
|
|
136
119
|
AvroQueryClient.prototype.useDeleteSelf = function () {
|
|
@@ -150,8 +133,5 @@ AvroQueryClient.prototype.useDeleteSelf = function () {
|
|
|
150
133
|
queryClient.setQueryData(['user'], context.previousUser);
|
|
151
134
|
}
|
|
152
135
|
},
|
|
153
|
-
onSettled: () => {
|
|
154
|
-
queryClient.invalidateQueries({ queryKey: ['user'] });
|
|
155
|
-
},
|
|
156
136
|
});
|
|
157
137
|
};
|
|
@@ -10,10 +10,6 @@ AvroQueryClient.prototype.useCreateWaiver = function () {
|
|
|
10
10
|
headers: { "Content-Type": "application/json" }
|
|
11
11
|
});
|
|
12
12
|
},
|
|
13
|
-
onSettled: () => {
|
|
14
|
-
queryClient.invalidateQueries({ queryKey: ['companies'] });
|
|
15
|
-
queryClient.invalidateQueries({ queryKey: ['waivers'] });
|
|
16
|
-
},
|
|
17
13
|
});
|
|
18
14
|
};
|
|
19
15
|
AvroQueryClient.prototype.useGetWaivers = function (body, total, onProgress) {
|
|
@@ -85,10 +81,6 @@ AvroQueryClient.prototype.useUpdateWaiver = function () {
|
|
|
85
81
|
queryClient.setQueryData(['waivers', waiverId], context.previousWaiver);
|
|
86
82
|
}
|
|
87
83
|
},
|
|
88
|
-
onSettled: (_data, _error, variables) => {
|
|
89
|
-
const { waiverId } = variables;
|
|
90
|
-
queryClient.invalidateQueries({ queryKey: ['waivers'] });
|
|
91
|
-
},
|
|
92
84
|
});
|
|
93
85
|
};
|
|
94
86
|
AvroQueryClient.prototype.useDeleteWaiver = function () {
|
|
@@ -119,8 +111,5 @@ AvroQueryClient.prototype.useDeleteWaiver = function () {
|
|
|
119
111
|
queryClient.setQueryData(['waivers'], context.previousWaivers);
|
|
120
112
|
}
|
|
121
113
|
},
|
|
122
|
-
onSettled: () => {
|
|
123
|
-
queryClient.invalidateQueries({ queryKey: ['waivers'] });
|
|
124
|
-
},
|
|
125
114
|
});
|
|
126
115
|
};
|