Removed template blockers for the time being IO-424

This commit is contained in:
Patrick Fic
2020-12-01 16:38:27 -08:00
parent dd69a73079
commit 73ec04705a
7 changed files with 490 additions and 743 deletions

View File

@@ -4,7 +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";
//import inlineCss from "inline-css";
export default function ShopTemplateSaveButton({
templateId,
@@ -16,41 +16,42 @@ export default function ShopTemplateSaveButton({
const [updateTemplate] = useMutation(UPDATE_TEMPLATE);
const handleSave = async () => {
logImEXEvent("shop_template_update");
setLoading(true);
emailEditorRef.current.exportHtml(async (data) => {
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),
}),
});
}
setLoading(false);
});
});
alert("Outstanding issue IO-424");
// logImEXEvent("shop_template_update");
// setLoading(true);
// emailEditorRef.current.exportHtml(async (data) => {
// 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),
// }),
// });
// }
// setLoading(false);
// });
// });
};
return (
<Button disabled={!!!templateId} loading={loading} onClick={handleSave}>
{t("general.actions.save")}
{t("general.actions.save")} <span>IO-424</span>
</Button>
);
}