Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

monograph: fix API_HOST on client Signed-off-by: 01zulfi <[email protected]>

01zulfi29c69418e97e
diff --git a/apps/monograph/app/components/monographpost/index.tsx b/apps/monograph/app/components/monographpost/index.tsx
index 21fc0c409..2c3790f0b 100644
--- a/apps/monograph/app/components/monographpost/index.tsx
+++ b/apps/monograph/app/components/monographpost/index.tsx
@@ -107,10 +107,12 @@ function generateTableOfContents() {
export const MonographPage = ({
monograph,
- encodedKey
+ encodedKey,
+ apiHost
}: {
monograph: Monograph;
encodedKey?: string;
+ apiHost: string;
}) => {
const [reportDialogVisible, setReportDialogVisible] = useState(false);
const [tableOfContents, setTableOfContents] = useState<TableOfContent[]>([]);
@@ -227,7 +229,7 @@ export const MonographPage = ({
)}
<Image
sx={{ display: "none" }}
- src={`https://api.notesnook.com/monographs/${monograph.id}/view`}
+ src={`${apiHost}/monographs/${monograph.id}/view`}
/>
</Flex>
</Box>
diff --git a/apps/monograph/app/routes/$id.tsx b/apps/monograph/app/routes/$id.tsx
index afff0215f..f42f70c8f 100644
--- a/apps/monograph/app/routes/$id.tsx
+++ b/apps/monograph/app/routes/$id.tsx
@@ -85,7 +85,8 @@ export async function loader({ params }: LoaderFunctionArgs) {
const metadata = getMonographMetadata(monograph);
return {
monograph,
- metadata
+ metadata,
+ apiHost: API_HOST
};
} catch (e) {
// console.error(e);
@@ -96,19 +97,24 @@ export async function loader({ params }: LoaderFunctionArgs) {
fullDescription: "This monograph does not exist.",
shortDescription: "This monograph does not exist.",
datePublished: ""
- }
+ },
+ apiHost: API_HOST
};
}
}
export default function MonographPost() {
- const { monograph } = useLoaderData<typeof loader>();
+ const { monograph, apiHost } = useLoaderData<typeof loader>();
const [_, hashParams] = useHashLocation();
return (
<>
{monograph ? (
- <MonographPage monograph={monograph} encodedKey={hashParams.key} />
+ <MonographPage
+ monograph={monograph}
+ encodedKey={hashParams.key}
+ apiHost={apiHost}
+ />
) : (
<>
<Header />