Merged in feature/IO-2368-QBO-Successful-Export (pull request #964)

IO-2368 Update Cache on QBD posting success
This commit is contained in:
Allan Carr
2023-09-06 23:23:53 +00:00
6 changed files with 74 additions and 2 deletions

View File

@@ -156,6 +156,18 @@ export function JobsCloseExportButton({
date_exported: new Date(),
},
},
update(cache) {
cache.modify({
id: "ROOT_QUERY",
fields: {
jobs(existingJobs = []) {
return existingJobs.filter(
(jobRef) => jobRef.__ref.includes(jobId) === false
);
},
},
});
},
});
if (!jobUpdateResponse.errors) {
@@ -185,7 +197,7 @@ export function JobsCloseExportButton({
});
}
}
if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) refetch();
//if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) refetch();
setLoading(false);
};

View File

@@ -153,6 +153,18 @@ export function JobsExportAllButton({
date_exported: new Date(),
},
},
update(cache) {
cache.modify({
id: "ROOT_QUERY",
fields: {
jobs(existingJobs = []) {
return existingJobs.filter(
(jobRef) => jobRef.__ref.includes([key]) === false
);
},
},
});
},
});
if (!jobUpdateResponse.errors) {
@@ -182,7 +194,7 @@ export function JobsExportAllButton({
if (!!completedCallback) completedCallback([]);
if (!!loadingCallback) loadingCallback(false);
if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) refetch();
// if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) refetch();
setLoading(false);
};

View File

@@ -148,6 +148,18 @@ export function PayableExportAll({
exported_at: new Date(),
},
},
update(cache) {
cache.modify({
id: "ROOT_QUERY",
fields: {
bills(existingJobs = []) {
return existingJobs.filter(
(billRef) => billRef.__ref.includes([key]) === false
);
},
},
});
},
});
if (!!!billUpdateResponse.errors) {
notification.open({

View File

@@ -151,6 +151,18 @@ export function PayableExportButton({
exported_at: new Date(),
},
},
update(cache) {
cache.modify({
id: "ROOT_QUERY",
fields: {
bills(existingJobs = []) {
return existingJobs.filter(
(billRef) => billRef.__ref.includes(billId) === false
);
},
},
});
},
});
if (!!!billUpdateResponse.errors) {
notification.open({

View File

@@ -150,6 +150,18 @@ export function PaymentExportButton({
exportedat: new Date(),
},
},
update(cache) {
cache.modify({
id: "ROOT_QUERY",
fields: {
payments(existingJobs = []) {
return existingJobs.filter(
(paymentRef) => paymentRef.__ref.includes(paymentId) === false
);
},
},
});
},
});
if (!!!paymentUpdateResponse.errors) {
notification.open({

View File

@@ -135,6 +135,18 @@ export function PaymentsExportAllButton({
exportedat: new Date(),
},
},
update(cache) {
cache.modify({
id: "ROOT_QUERY",
fields: {
payments(existingJobs = []) {
return existingJobs.filter(
(paymentRef) => paymentRef.__ref.includes([key]) === false
);
},
},
});
},
});
if (!!!paymentUpdateResponse.errors) {
notification.open({