Added third party payer support IO-546

This commit is contained in:
Patrick Fic
2021-02-10 14:07:08 -08:00
parent 563d3a189a
commit 9e2c17670f
12 changed files with 599 additions and 15 deletions

View File

@@ -44,11 +44,15 @@ export default async function RenderTemplate(
"There are too many queries to choose from. Please ensure there are no conflicting keys."
);
}
const { data: contextData } = await client.query({
query: gql(templateQueryToExecute),
variables: { ...templateObject.variables },
fetchPolicy: "network-only",
});
let contextData;
if (templateQueryToExecute) {
const { data } = await client.query({
query: gql(templateQueryToExecute),
variables: { ...templateObject.variables },
fetchPolicy: "network-only",
});
contextData = data;
}
let reportRequest = {
template: {
@@ -58,8 +62,9 @@ export default async function RenderTemplate(
...(renderAsHtml ? {} : { recipe: "chrome-pdf" }),
},
data: {
...contextData,
...(templateQueryToExecute ? contextData : {}),
...templateObject.variables,
...templateObject.context,
headerpath: `/${bodyshop.imexshopid}/header.html`,
bodyshop: bodyshop,
},