mirror of
https://github.com/labring/FastGPT.git
synced 2025-12-25 20:02:47 +00:00
unauth refresh
This commit is contained in:
parent
77d4c2dea8
commit
85d910de52
|
|
@ -17,12 +17,14 @@ export function useLinkedScroll<
|
|||
pageSize = 10,
|
||||
params = {},
|
||||
currentData,
|
||||
defaultScroll = 'top'
|
||||
defaultScroll = 'top',
|
||||
showErrorToast = true
|
||||
}: {
|
||||
pageSize?: number;
|
||||
params?: Record<string, any>;
|
||||
currentData?: { id: string; anchor?: any };
|
||||
defaultScroll?: 'top' | 'bottom';
|
||||
showErrorToast?: boolean;
|
||||
}
|
||||
) {
|
||||
const { t } = useTranslation();
|
||||
|
|
@ -105,7 +107,8 @@ export function useLinkedScroll<
|
|||
onFinally() {
|
||||
isInit.current = true;
|
||||
},
|
||||
manual: false
|
||||
manual: false,
|
||||
errorToast: showErrorToast ? undefined : ''
|
||||
}
|
||||
);
|
||||
useEffect(() => {
|
||||
|
|
@ -153,7 +156,8 @@ export function useLinkedScroll<
|
|||
return response;
|
||||
},
|
||||
{
|
||||
refreshDeps: [hasMorePrev, isLoading, params, pageSize]
|
||||
refreshDeps: [hasMorePrev, isLoading, params, pageSize],
|
||||
errorToast: showErrorToast ? undefined : ''
|
||||
}
|
||||
);
|
||||
|
||||
|
|
@ -188,7 +192,8 @@ export function useLinkedScroll<
|
|||
return response;
|
||||
},
|
||||
{
|
||||
refreshDeps: [hasMoreNext, isLoading, params, pageSize]
|
||||
refreshDeps: [hasMoreNext, isLoading, params, pageSize],
|
||||
errorToast: showErrorToast ? undefined : ''
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -269,7 +269,7 @@ export function useScrollPagination<
|
|||
} catch (error: any) {
|
||||
if (showErrorToast) {
|
||||
toast({
|
||||
title: getErrText(error, t('common:core.chat.error.data_error')),
|
||||
title: t(getErrText(error, t('common:core.chat.error.data_error'))),
|
||||
status: 'error'
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import ChatSliderMobileDrawer from '@/pageComponents/chat/slider/ChatSliderMobil
|
|||
import dynamic from 'next/dynamic';
|
||||
import { getNanoid } from '@fastgpt/global/common/string/tools';
|
||||
import { ChatErrEnum } from '@fastgpt/global/common/error/code/chat';
|
||||
import { AppErrEnum } from '@fastgpt/global/common/error/code/app';
|
||||
|
||||
const CustomPluginRunBox = dynamic(() => import('@/pageComponents/chat/CustomPluginRunBox'));
|
||||
|
||||
|
|
@ -79,6 +80,9 @@ const AppChatWindow = () => {
|
|||
onChangeChatId();
|
||||
return;
|
||||
}
|
||||
if (e?.statusText === AppErrEnum.unAuthApp) {
|
||||
refreshRecentlyUsed();
|
||||
}
|
||||
handlePaneChange(ChatSidebarPaneEnum.TEAM_APPS);
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ async function handler(
|
|||
}
|
||||
};
|
||||
} catch (error: any) {
|
||||
if (error === AppErrEnum.unAuthApp) {
|
||||
if (error === AppErrEnum.unAuthApp && appId) {
|
||||
const { tmbId } = await authCert({
|
||||
req,
|
||||
authToken: true,
|
||||
|
|
|
|||
|
|
@ -67,8 +67,7 @@ const ChatRecordContextProvider = ({
|
|||
setDataList: setChatRecords,
|
||||
ScrollData,
|
||||
isLoading,
|
||||
itemRefs,
|
||||
loadInitData
|
||||
itemRefs
|
||||
} = useLinkedScroll(
|
||||
async (
|
||||
data: LinkedPaginationProps<GetChatRecordsProps>
|
||||
|
|
@ -94,7 +93,8 @@ const ChatRecordContextProvider = ({
|
|||
pageSize: 10,
|
||||
params,
|
||||
currentData,
|
||||
defaultScroll: 'bottom'
|
||||
defaultScroll: 'bottom',
|
||||
showErrorToast: false
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue