mirror of
https://github.com/umami-software/umami.git
synced 2026-02-10 07:37:11 +01:00
fix: basePath display in Website shareUrl
This commit is contained in:
parent
e7336601a6
commit
7fa0d2b4ac
1 changed files with 3 additions and 1 deletions
|
|
@ -12,6 +12,7 @@ import { useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { getRandomChars } from 'next-basics';
|
import { getRandomChars } from 'next-basics';
|
||||||
import useApi from 'hooks/useApi';
|
import useApi from 'hooks/useApi';
|
||||||
import useMessages from 'hooks/useMessages';
|
import useMessages from 'hooks/useMessages';
|
||||||
|
import useConfig from 'hooks/useConfig';
|
||||||
|
|
||||||
const generateId = () => getRandomChars(16);
|
const generateId = () => getRandomChars(16);
|
||||||
|
|
||||||
|
|
@ -20,12 +21,13 @@ export function ShareUrl({ websiteId, data, onSave }) {
|
||||||
const { name, shareId } = data;
|
const { name, shareId } = data;
|
||||||
const [id, setId] = useState(shareId);
|
const [id, setId] = useState(shareId);
|
||||||
const { post, useMutation } = useApi();
|
const { post, useMutation } = useApi();
|
||||||
|
const { basePath } = useConfig();
|
||||||
const { mutate, error } = useMutation(({ shareId }) =>
|
const { mutate, error } = useMutation(({ shareId }) =>
|
||||||
post(`/websites/${websiteId}`, { shareId }),
|
post(`/websites/${websiteId}`, { shareId }),
|
||||||
);
|
);
|
||||||
const ref = useRef(null);
|
const ref = useRef(null);
|
||||||
const url = useMemo(
|
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],
|
[id, name],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue