mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-21 02:40:14 +01:00
🔧 fix(Shared Links): Handling Shared Link Errors (#3118)
* refactor: add error handling in Share model * refactor: add error handing to API routers * refactor: display error message when API response is an error * chore: remove unneccesary JSON.stringify * chore: revert unintended changes --------- Co-authored-by: Danny Avila <danny@librechat.ai>
This commit is contained in:
parent
3172381bad
commit
4e4de88faa
23 changed files with 323 additions and 75 deletions
|
|
@ -1,8 +1,10 @@
|
|||
import { useState } from 'react';
|
||||
import copy from 'copy-to-clipboard';
|
||||
import { Copy, Link } from 'lucide-react';
|
||||
import { useUpdateSharedLinkMutation } from '~/data-provider';
|
||||
import type { TSharedLink } from 'librechat-data-provider';
|
||||
import { useUpdateSharedLinkMutation } from '~/data-provider';
|
||||
import { NotificationSeverity } from '~/common';
|
||||
import { useToastContext } from '~/Providers';
|
||||
import { Spinner } from '~/components/svg';
|
||||
import { Button } from '~/components/ui';
|
||||
import { useLocalize } from '~/hooks';
|
||||
|
|
@ -21,8 +23,18 @@ export default function SharedLinkButton({
|
|||
setIsUpdated: (isUpdated: boolean) => void;
|
||||
}) {
|
||||
const localize = useLocalize();
|
||||
const { showToast } = useToastContext();
|
||||
const [isCopying, setIsCopying] = useState(false);
|
||||
const { mutateAsync, isLoading } = useUpdateSharedLinkMutation();
|
||||
|
||||
const { mutateAsync, isLoading } = useUpdateSharedLinkMutation({
|
||||
onError: () => {
|
||||
showToast({
|
||||
message: localize('com_ui_share_error'),
|
||||
severity: NotificationSeverity.ERROR,
|
||||
showIcon: true,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
const copyLink = () => {
|
||||
if (!share) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue