Added required authorization for all API calls. Added template stylesheet.
This commit is contained in:
@@ -18,9 +18,25 @@ import App from "./App";
|
||||
import { ConfigProvider } from "antd";
|
||||
import enLocale from "antd/es/locale/en_US";
|
||||
import moment from "moment";
|
||||
import axios from "axios";
|
||||
|
||||
moment.locale("en-US");
|
||||
|
||||
axios.interceptors.request.use(
|
||||
async (config) => {
|
||||
if (!config.headers.Authorization) {
|
||||
const token =
|
||||
auth.currentUser && (await auth.currentUser.getIdToken(true));
|
||||
if (token) {
|
||||
config.headers.Authorization = `Bearer ${token}`;
|
||||
}
|
||||
}
|
||||
|
||||
return config;
|
||||
},
|
||||
(error) => Promise.reject(error)
|
||||
);
|
||||
|
||||
if (process.env.NODE_ENV === "production") LogRocket.init("gvfvfw/bodyshopapp");
|
||||
|
||||
const httpLink = new HttpLink({
|
||||
|
||||
@@ -18,9 +18,11 @@ export default function ShopTemplateSaveButton({
|
||||
logImEXEvent("shop_template_update");
|
||||
|
||||
emailEditorRef.current.exportHtml(async (data) => {
|
||||
console.log("RAW", data.html);
|
||||
inlineCss(data.html, {
|
||||
url: `${window.location.protocol}://${window.location.host}`,
|
||||
url: `${window.location.protocol}://${window.location.host}/`,
|
||||
}).then(async function (inlineHtml) {
|
||||
console.log("Inline :>> ", inlineHtml);
|
||||
const result = await updateTemplate({
|
||||
variables: {
|
||||
templateId: templateId,
|
||||
|
||||
@@ -14,8 +14,9 @@ export default function ShopTemplateEditorComponent({
|
||||
const emailEditorRef = useRef(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (json && Object.keys(json).length > 0)
|
||||
if (json && Object.keys(json).length > 0 && emailEditorRef.current) {
|
||||
emailEditorRef.current.loadDesign(json);
|
||||
}
|
||||
}, [json, emailEditorRef]);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -46,6 +47,12 @@ export default function ShopTemplateEditorComponent({
|
||||
<EmailEditor
|
||||
ref={emailEditorRef}
|
||||
options={{
|
||||
// customCSS: [
|
||||
// window.location.protocol +
|
||||
// "//" +
|
||||
// window.location.host +
|
||||
// "/render-styles.css",
|
||||
// ],
|
||||
customJS: [
|
||||
window.location.protocol +
|
||||
"//" +
|
||||
|
||||
Reference in New Issue
Block a user