Minor fixes throughout the system.
This commit is contained in:
@@ -4,6 +4,7 @@ import { useMutation } from "@apollo/react-hooks";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { UPDATE_TEMPLATE } from "../../graphql/templates.queries";
|
||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||
import inlineCss from "inline-css";
|
||||
|
||||
export default function ShopTemplateSaveButton({
|
||||
templateId,
|
||||
@@ -17,28 +18,32 @@ export default function ShopTemplateSaveButton({
|
||||
logImEXEvent("shop_template_update");
|
||||
|
||||
emailEditorRef.current.exportHtml(async (data) => {
|
||||
console.log("handleSave -> html", data);
|
||||
const result = await updateTemplate({
|
||||
variables: {
|
||||
templateId: templateId,
|
||||
template: {
|
||||
query: gql,
|
||||
html: data.html,
|
||||
jsontemplate: data.design,
|
||||
console.log(data.html);
|
||||
inlineCss(data.html, {
|
||||
url: `${window.location.protocol}://${window.location.host}`,
|
||||
}).then(async function (inlineHtml) {
|
||||
const result = await updateTemplate({
|
||||
variables: {
|
||||
templateId: templateId,
|
||||
template: {
|
||||
query: gql,
|
||||
html: inlineHtml,
|
||||
jsontemplate: data.design,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
if (!!!result.errors) {
|
||||
notification["success"]({
|
||||
message: t("templates.successes.updated"),
|
||||
});
|
||||
} else {
|
||||
notification["error"]({
|
||||
message: t("templates.errors.updating", {
|
||||
error: JSON.stringify(result.errors),
|
||||
}),
|
||||
});
|
||||
}
|
||||
});
|
||||
if (!!!result.errors) {
|
||||
notification["success"]({
|
||||
message: t("templates.successes.updated"),
|
||||
});
|
||||
} else {
|
||||
notification["error"]({
|
||||
message: t("templates.errors.updating", {
|
||||
error: JSON.stringify(result.errors),
|
||||
}),
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user