diff --git a/.env-cmdrc b/.env-cmdrc index ef25452..b0fd1cc 100644 --- a/.env-cmdrc +++ b/.env-cmdrc @@ -5,6 +5,7 @@ "REACT_APP_BACKEND_PROTOCOL": "http", "REACT_APP_BACKEND_HOST": "localhost", "REACT_APP_BACKEND_PORT": "8090", + "REACT_APP_ADOBE_API_KEY": "97e02339319940a28d1181b1a06076a2", "REACT_APP_BACKEND_API_PATH": "/api" }, "2fi-production": { @@ -12,7 +13,8 @@ "REACT_APP_URL": "https://forms.lioner.com/", "REACT_APP_BACKEND_PROTOCOL": "https", "REACT_APP_BACKEND_HOST": "forms.lioner.com", - "REACT_APP_BACKEND_PORT": "8090", + "REACT_APP_BACKEND_PORT": "8090", + "REACT_APP_ADOBE_API_KEY": "ee4433f258a74641ae6d502fd41cf703", "REACT_APP_BACKEND_API_PATH": "/api" } } \ No newline at end of file diff --git a/src/auth/utils.js b/src/auth/utils.js index 75e0a83..ce16714 100644 --- a/src/auth/utils.js +++ b/src/auth/utils.js @@ -11,6 +11,7 @@ const hostPort = process.env.REACT_APP_BACKEND_PORT export const hostPath = `${process.env.REACT_APP_BACKEND_PROTOCOL}://${hostname}:${hostPort}` export const apiPath = `${hostPath}/api` export const appURL = `${process.env.REACT_APP_URL}` +export const adobeAPIKey = `${process.env.REACT_APP_ADOBE_API_KEY}` export const isUserLoggedIn = () => { return localStorage.getItem('userData') && localStorage.getItem(useJwt.jwtConfig.storageTokenKeyName) diff --git a/src/pages/pdf/PdfViewer/index.js b/src/pages/pdf/PdfViewer/index.js index d3c130c..fdc1003 100644 --- a/src/pages/pdf/PdfViewer/index.js +++ b/src/pages/pdf/PdfViewer/index.js @@ -1,6 +1,6 @@ import React, { useEffect, useRef, useState } from 'react'; import { useParams } from 'react-router-dom'; // Import useParams -import { apiPath, GET_PDF_PATH } from "../../../auth/utils"; +import { apiPath, adobeAPIKey } from "../../../auth/utils"; const PdfViewer = ({ pdfUrl, formCode }) => { const { id } = useParams(); @@ -45,7 +45,7 @@ const PdfViewer = ({ pdfUrl, formCode }) => { const loadAdobeSDK = () => { if (window.AdobeDC) { const adobeDCView = new window.AdobeDC.View({ - clientId: '97e02339319940a28d1181b1a06076a2', + clientId: `${adobeAPIKey}`, divId: 'adobe-dc-view', }); @@ -73,7 +73,7 @@ const PdfViewer = ({ pdfUrl, formCode }) => { window.AdobeDC.View.Enum.CallbackType.SAVE_API, async (metaData, content, options) => { try { - const saveUrl = `http://localhost:8090/api/pdf2/save-pdf?clientId=${encodeURIComponent(id)}&formCode=${encodeURIComponent(formCode)}`; + const saveUrl = `${apiPath}/pdf2/save-pdf?clientId=${encodeURIComponent(id)}&formCode=${encodeURIComponent(formCode)}`; console.log('Saving to:', saveUrl); console.log('Authorization header:', `Bearer ${token}`); const response = await fetch(saveUrl, {