Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

fix: basePath display in Website shareUrl

nailuoGG7fa0d2b4aca0
diff --git a/components/pages/settings/websites/ShareUrl.js b/components/pages/settings/websites/ShareUrl.js
index 673440eb5..35185da13 100644
--- a/components/pages/settings/websites/ShareUrl.js
+++ b/components/pages/settings/websites/ShareUrl.js
@@ -12,6 +12,7 @@ import { useEffect, useMemo, useRef, useState } from 'react';
import { getRandomChars } from 'next-basics';
import useApi from 'hooks/useApi';
import useMessages from 'hooks/useMessages';
+import useConfig from 'hooks/useConfig';
const generateId = () => getRandomChars(16);
@@ -20,12 +21,13 @@ export function ShareUrl({ websiteId, data, onSave }) {
const { name, shareId } = data;
const [id, setId] = useState(shareId);
const { post, useMutation } = useApi();
+ const { basePath } = useConfig();
const { mutate, error } = useMutation(({ shareId }) =>
post(`/websites/${websiteId}`, { shareId }),
);
const ref = useRef(null);
const url = useMemo(
- () => `${process.env.analyticsUrl || location.origin}${process.env.BASE_PATH || ''}/share/${id}/${encodeURIComponent(name)}`,
+ () => `${process.env.analyticsUrl || location.origin}${basePath || ''}/share/${id}/${encodeURIComponent(name)}`,
[id, name],
);