Skip to content

Commit

Permalink
Merge pull request umami-software#2140 from nailuoGG/master
Browse files Browse the repository at this point in the history
Include BASE_PATH in URL for Umami hosted under subdirectory
  • Loading branch information
mikecao authored Jul 27, 2023
2 parents 362a469 + 7fa0d2b commit c9e4003
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion components/pages/settings/websites/ShareUrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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}/share/${id}/${encodeURIComponent(name)}`,
() => `${process.env.analyticsUrl || location.origin}${basePath || ''}/share/${id}/${encodeURIComponent(name)}`,
[id, name],
);

Expand Down

0 comments on commit c9e4003

Please sign in to comment.