mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-06 02:28:51 +01:00
🔗 fix: Share Links Respect Custom Base Path (#11087)
* fix: share links respect base path Fixes #11072 * chore: import order * chore: import order --------- Co-authored-by: Dustin Healy <54083382+dustinhealy@users.noreply.github.com>
This commit is contained in:
parent
5740ca59d8
commit
9b6e7cabc9
5 changed files with 34 additions and 7 deletions
|
|
@ -6,7 +6,7 @@ import { useGetSharedLinkQuery } from 'librechat-data-provider/react-query';
|
|||
import { OGDialogTemplate, Button, Spinner, OGDialog } from '@librechat/client';
|
||||
import { useLocalize, useCopyToClipboard } from '~/hooks';
|
||||
import SharedLinkButton from './SharedLinkButton';
|
||||
import { cn } from '~/utils';
|
||||
import { buildShareLinkUrl, cn } from '~/utils';
|
||||
import store from '~/store';
|
||||
|
||||
export default function ShareButton({
|
||||
|
|
@ -40,8 +40,7 @@ export default function ShareButton({
|
|||
|
||||
useEffect(() => {
|
||||
if (share?.shareId !== undefined) {
|
||||
const link = `${window.location.protocol}//${window.location.host}/share/${share.shareId}`;
|
||||
setSharedLink(link);
|
||||
setSharedLink(buildShareLinkUrl(share.shareId));
|
||||
}
|
||||
}, [share]);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { useState, useCallback, useRef } from 'react';
|
||||
import { useState, useRef } from 'react';
|
||||
import { Trans } from 'react-i18next';
|
||||
import { QrCode, RotateCw, Trash2 } from 'lucide-react';
|
||||
import {
|
||||
|
|
@ -20,6 +20,7 @@ import {
|
|||
useDeleteSharedLinkMutation,
|
||||
} from '~/data-provider';
|
||||
import { NotificationSeverity } from '~/common';
|
||||
import { buildShareLinkUrl } from '~/utils';
|
||||
import { useLocalize } from '~/hooks';
|
||||
|
||||
export default function SharedLinkButton({
|
||||
|
|
@ -85,9 +86,7 @@ export default function SharedLinkButton({
|
|||
},
|
||||
});
|
||||
|
||||
const generateShareLink = useCallback((shareId: string) => {
|
||||
return `${window.location.protocol}//${window.location.host}/share/${shareId}`;
|
||||
}, []);
|
||||
const generateShareLink = (shareId: string) => buildShareLinkUrl(shareId);
|
||||
|
||||
const updateSharedLink = async () => {
|
||||
if (!shareId) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue