fix: load member list (#2536)
* fix: load member list * fix: extract field type error * fix: workflow runtime error * fix: ts
This commit is contained in:
parent
77e6cf4157
commit
f6e2d13e21
@ -67,3 +67,5 @@ curl --location --request POST 'https://{{host}}/api/admin/initv4810' \
|
|||||||
18. 修复 - 选择 Milvus 部署时,无法导出知识库。
|
18. 修复 - 选择 Milvus 部署时,无法导出知识库。
|
||||||
19. 修复 - 创建 APP 副本,无法复制系统配置。
|
19. 修复 - 创建 APP 副本,无法复制系统配置。
|
||||||
20. 修复 - 图片识别模式下,自动解析图片链接正则不够严谨问题。
|
20. 修复 - 图片识别模式下,自动解析图片链接正则不够严谨问题。
|
||||||
|
21. 修复 - 内容提取的数据类型与输出数据类型未一致。
|
||||||
|
22. 修复 - 工作流运行时间统计错误。
|
||||||
|
|||||||
@ -1,5 +1,10 @@
|
|||||||
|
import { WorkflowIOValueTypeEnum } from '../../../constants';
|
||||||
|
|
||||||
export type ContextExtractAgentItemType = {
|
export type ContextExtractAgentItemType = {
|
||||||
valueType: 'string' | 'number' | 'boolean';
|
valueType:
|
||||||
|
| WorkflowIOValueTypeEnum.string
|
||||||
|
| WorkflowIOValueTypeEnum.number
|
||||||
|
| WorkflowIOValueTypeEnum.boolean;
|
||||||
desc: string;
|
desc: string;
|
||||||
key: string;
|
key: string;
|
||||||
required: boolean;
|
required: boolean;
|
||||||
|
|||||||
@ -46,6 +46,7 @@ const ResponseTags = ({
|
|||||||
};
|
};
|
||||||
}>();
|
}>();
|
||||||
const [quoteFolded, setQuoteFolded] = useState<boolean>(true);
|
const [quoteFolded, setQuoteFolded] = useState<boolean>(true);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
isOpen: isOpenWholeModal,
|
isOpen: isOpenWholeModal,
|
||||||
onOpen: onOpenWholeModal,
|
onOpen: onOpenWholeModal,
|
||||||
@ -56,6 +57,7 @@ const ResponseTags = ({
|
|||||||
onOpen: onOpenContextModal,
|
onOpen: onOpenContextModal,
|
||||||
onClose: onCloseContextModal
|
onClose: onCloseContextModal
|
||||||
} = useDisclosure();
|
} = useDisclosure();
|
||||||
|
|
||||||
useSize(quoteListRef);
|
useSize(quoteListRef);
|
||||||
const quoteIsOverflow = quoteListRef.current
|
const quoteIsOverflow = quoteListRef.current
|
||||||
? quoteListRef.current.scrollHeight > (isPc ? 50 : 55)
|
? quoteListRef.current.scrollHeight > (isPc ? 50 : 55)
|
||||||
|
|||||||
@ -100,7 +100,7 @@ const WholeResponseModal = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const { appId, chatId, getHistoryResponseData } = useContextSelector(ChatBoxContext, (v) => v);
|
const { getHistoryResponseData } = useContextSelector(ChatBoxContext, (v) => v);
|
||||||
const { loading: isLoading, data: response } = useRequest2(
|
const { loading: isLoading, data: response } = useRequest2(
|
||||||
() => getHistoryResponseData({ dataId }),
|
() => getHistoryResponseData({ dataId }),
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { getTeamMembers } from '@/web/support/user/team/api';
|
import { useUserStore } from '@/web/support/user/useUserStore';
|
||||||
import {
|
import {
|
||||||
Box,
|
Box,
|
||||||
Flex,
|
Flex,
|
||||||
@ -31,11 +31,13 @@ export function ChangeOwnerModal({
|
|||||||
onChangeOwner
|
onChangeOwner
|
||||||
}: ChangeOwnerModalProps & { onClose: () => void }) {
|
}: ChangeOwnerModalProps & { onClose: () => void }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
const { loadAndGetTeamMembers } = useUserStore();
|
||||||
|
|
||||||
const [inputValue, setInputValue] = React.useState('');
|
const [inputValue, setInputValue] = React.useState('');
|
||||||
const { data: teamMembers = [] } = useRequest2(getTeamMembers, {
|
|
||||||
|
const { data: teamMembers = [] } = useRequest2(loadAndGetTeamMembers, {
|
||||||
manual: false
|
manual: false
|
||||||
});
|
});
|
||||||
|
|
||||||
const memberList = teamMembers.filter((item) => {
|
const memberList = teamMembers.filter((item) => {
|
||||||
return item.memberName.includes(inputValue);
|
return item.memberName.includes(inputValue);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -20,7 +20,6 @@ import PermissionSelect from './PermissionSelect';
|
|||||||
import PermissionTags from './PermissionTags';
|
import PermissionTags from './PermissionTags';
|
||||||
import { CollaboratorContext } from './context';
|
import { CollaboratorContext } from './context';
|
||||||
import { useUserStore } from '@/web/support/user/useUserStore';
|
import { useUserStore } from '@/web/support/user/useUserStore';
|
||||||
import { getTeamMembers } from '@/web/support/user/team/api';
|
|
||||||
import MyBox from '@fastgpt/web/components/common/MyBox';
|
import MyBox from '@fastgpt/web/components/common/MyBox';
|
||||||
import { ChevronDownIcon } from '@chakra-ui/icons';
|
import { ChevronDownIcon } from '@chakra-ui/icons';
|
||||||
import Avatar from '@fastgpt/web/components/common/Avatar';
|
import Avatar from '@fastgpt/web/components/common/Avatar';
|
||||||
@ -33,15 +32,16 @@ export type AddModalPropsType = {
|
|||||||
|
|
||||||
function AddMemberModal({ onClose }: AddModalPropsType) {
|
function AddMemberModal({ onClose }: AddModalPropsType) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { userInfo } = useUserStore();
|
const { userInfo, loadAndGetTeamMembers } = useUserStore();
|
||||||
|
|
||||||
const { permissionList, collaboratorList, onUpdateCollaborators, getPerLabelList } =
|
const { permissionList, collaboratorList, onUpdateCollaborators, getPerLabelList } =
|
||||||
useContextSelector(CollaboratorContext, (v) => v);
|
useContextSelector(CollaboratorContext, (v) => v);
|
||||||
const [searchText, setSearchText] = useState<string>('');
|
const [searchText, setSearchText] = useState<string>('');
|
||||||
|
|
||||||
const { data: members = [], loading: loadingMembers } = useRequest2(
|
const { data: members = [], loading: loadingMembers } = useRequest2(
|
||||||
async () => {
|
async () => {
|
||||||
if (!userInfo?.team?.teamId) return [];
|
if (!userInfo?.team?.teamId) return [];
|
||||||
const members = await getTeamMembers();
|
const members = await loadAndGetTeamMembers(true);
|
||||||
return members;
|
return members;
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -6,7 +6,6 @@ import { useQuery } from '@tanstack/react-query';
|
|||||||
import {
|
import {
|
||||||
delMemberPermission,
|
delMemberPermission,
|
||||||
getTeamList,
|
getTeamList,
|
||||||
getTeamMembers,
|
|
||||||
putSwitchTeam,
|
putSwitchTeam,
|
||||||
updateMemberPermission
|
updateMemberPermission
|
||||||
} from '@/web/support/user/team/api';
|
} from '@/web/support/user/team/api';
|
||||||
@ -56,7 +55,7 @@ export const TeamModalContext = createContext<TeamModalContextType>({
|
|||||||
export const TeamModalContextProvider = ({ children }: { children: ReactNode }) => {
|
export const TeamModalContextProvider = ({ children }: { children: ReactNode }) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [editTeamData, setEditTeamData] = useState<EditTeamFormDataType>();
|
const [editTeamData, setEditTeamData] = useState<EditTeamFormDataType>();
|
||||||
const { userInfo, initUserInfo } = useUserStore();
|
const { userInfo, initUserInfo, loadAndGetTeamMembers } = useUserStore();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
data: myTeams = [],
|
data: myTeams = [],
|
||||||
@ -72,7 +71,7 @@ export const TeamModalContextProvider = ({ children }: { children: ReactNode })
|
|||||||
} = useRequest2(
|
} = useRequest2(
|
||||||
() => {
|
() => {
|
||||||
if (!userInfo?.team?.teamId) return Promise.resolve([]);
|
if (!userInfo?.team?.teamId) return Promise.resolve([]);
|
||||||
return getTeamMembers();
|
return loadAndGetTeamMembers();
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
manual: false,
|
manual: false,
|
||||||
|
|||||||
@ -27,6 +27,7 @@ export function addStatisticalDataToHistoryItem(historyItem: ChatItemType) {
|
|||||||
return item;
|
return item;
|
||||||
})
|
})
|
||||||
.flat() || [];
|
.flat() || [];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...historyItem,
|
...historyItem,
|
||||||
llmModuleAccount: flatResData.filter(isLLMNode).length,
|
llmModuleAccount: flatResData.filter(isLLMNode).length,
|
||||||
@ -36,7 +37,7 @@ export function addStatisticalDataToHistoryItem(historyItem: ChatItemType) {
|
|||||||
.flat()
|
.flat()
|
||||||
.filter(Boolean) as SearchDataResponseItemType[],
|
.filter(Boolean) as SearchDataResponseItemType[],
|
||||||
totalRunningTime: Number(
|
totalRunningTime: Number(
|
||||||
flatResData.reduce((sum, item) => sum + (item.runningTime || 0), 0).toFixed(2)
|
historyItem.responseData?.reduce((sum, item) => sum + (item.runningTime || 0), 0).toFixed(2)
|
||||||
),
|
),
|
||||||
historyPreviewLength: flatResData.find(isLLMNode)?.historyPreview?.length
|
historyPreviewLength: flatResData.find(isLLMNode)?.historyPreview?.length
|
||||||
};
|
};
|
||||||
|
|||||||
@ -26,7 +26,6 @@ import { useSystemStore } from '@/web/common/system/useSystemStore';
|
|||||||
import { useTranslation } from 'next-i18next';
|
import { useTranslation } from 'next-i18next';
|
||||||
import { useQuery } from '@tanstack/react-query';
|
import { useQuery } from '@tanstack/react-query';
|
||||||
import { useUserStore } from '@/web/support/user/useUserStore';
|
import { useUserStore } from '@/web/support/user/useUserStore';
|
||||||
import { getTeamMembers } from '@/web/support/user/team/api';
|
|
||||||
import Avatar from '@fastgpt/web/components/common/Avatar';
|
import Avatar from '@fastgpt/web/components/common/Avatar';
|
||||||
import MySelect from '@fastgpt/web/components/common/MySelect';
|
import MySelect from '@fastgpt/web/components/common/MySelect';
|
||||||
import { formatNumber } from '@fastgpt/global/common/math/tools';
|
import { formatNumber } from '@fastgpt/global/common/math/tools';
|
||||||
@ -43,7 +42,7 @@ const UsageTable = () => {
|
|||||||
});
|
});
|
||||||
const [usageSource, setUsageSource] = useState<UsageSourceEnum | ''>('');
|
const [usageSource, setUsageSource] = useState<UsageSourceEnum | ''>('');
|
||||||
const { isPc } = useSystem();
|
const { isPc } = useSystem();
|
||||||
const { userInfo } = useUserStore();
|
const { userInfo, loadAndGetTeamMembers } = useUserStore();
|
||||||
const [usageDetail, setUsageDetail] = useState<UsageItemType>();
|
const [usageDetail, setUsageDetail] = useState<UsageItemType>();
|
||||||
|
|
||||||
const sourceList = useMemo(
|
const sourceList = useMemo(
|
||||||
@ -64,7 +63,7 @@ const UsageTable = () => {
|
|||||||
const [selectTmbId, setSelectTmbId] = useState(userInfo?.team?.tmbId);
|
const [selectTmbId, setSelectTmbId] = useState(userInfo?.team?.tmbId);
|
||||||
const { data: members = [] } = useQuery(['getMembers', userInfo?.team?.teamId], () => {
|
const { data: members = [] } = useQuery(['getMembers', userInfo?.team?.teamId], () => {
|
||||||
if (!userInfo?.team?.teamId) return [];
|
if (!userInfo?.team?.teamId) return [];
|
||||||
return getTeamMembers();
|
return loadAndGetTeamMembers();
|
||||||
});
|
});
|
||||||
const tmbList = useMemo(
|
const tmbList = useMemo(
|
||||||
() =>
|
() =>
|
||||||
|
|||||||
@ -20,7 +20,7 @@ import FormLabel from '@fastgpt/web/components/common/MyBox/FormLabel';
|
|||||||
import { WorkflowIOValueTypeEnum } from '@fastgpt/global/core/workflow/constants';
|
import { WorkflowIOValueTypeEnum } from '@fastgpt/global/core/workflow/constants';
|
||||||
|
|
||||||
export const defaultField: ContextExtractAgentItemType = {
|
export const defaultField: ContextExtractAgentItemType = {
|
||||||
valueType: 'string',
|
valueType: WorkflowIOValueTypeEnum.string,
|
||||||
required: false,
|
required: false,
|
||||||
defaultValue: '',
|
defaultValue: '',
|
||||||
desc: '',
|
desc: '',
|
||||||
|
|||||||
@ -198,7 +198,7 @@ const NodeExtract = ({ data }: NodeProps<FlowNodeItemType>) => {
|
|||||||
id: getNanoid(),
|
id: getNanoid(),
|
||||||
key: data.key,
|
key: data.key,
|
||||||
label: `${t('common:extraction_results')}-${data.desc}`,
|
label: `${t('common:extraction_results')}-${data.desc}`,
|
||||||
valueType: WorkflowIOValueTypeEnum.string,
|
valueType: data.valueType || WorkflowIOValueTypeEnum.string,
|
||||||
type: FlowNodeOutputTypeEnum.static
|
type: FlowNodeOutputTypeEnum.static
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -215,7 +215,8 @@ const NodeExtract = ({ data }: NodeProps<FlowNodeItemType>) => {
|
|||||||
key: data.key,
|
key: data.key,
|
||||||
value: {
|
value: {
|
||||||
...output,
|
...output,
|
||||||
label: `${t('common:extraction_results')}-${data.desc}`
|
valueType: newOutput.valueType,
|
||||||
|
label: newOutput.label
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -6,7 +6,6 @@ import { useConfirm } from '@fastgpt/web/hooks/useConfirm';
|
|||||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||||
import Avatar from '@fastgpt/web/components/common/Avatar';
|
import Avatar from '@fastgpt/web/components/common/Avatar';
|
||||||
import PermissionIconText from '@/components/support/permission/IconText';
|
import PermissionIconText from '@/components/support/permission/IconText';
|
||||||
import { useI18n } from '@/web/context/I18n';
|
|
||||||
import EmptyTip from '@fastgpt/web/components/common/EmptyTip';
|
import EmptyTip from '@fastgpt/web/components/common/EmptyTip';
|
||||||
import { useTranslation } from 'next-i18next';
|
import { useTranslation } from 'next-i18next';
|
||||||
import MyBox from '@fastgpt/web/components/common/MyBox';
|
import MyBox from '@fastgpt/web/components/common/MyBox';
|
||||||
@ -35,19 +34,19 @@ const ConfigPerModal = dynamic(() => import('@/components/support/permission/Con
|
|||||||
|
|
||||||
import type { EditHttpPluginProps } from './HttpPluginEditModal';
|
import type { EditHttpPluginProps } from './HttpPluginEditModal';
|
||||||
import { postCopyApp } from '@/web/core/app/api/app';
|
import { postCopyApp } from '@/web/core/app/api/app';
|
||||||
import { getTeamMembers } from '@/web/support/user/team/api';
|
|
||||||
import { formatTimeToChatTime } from '@fastgpt/global/common/string/time';
|
import { formatTimeToChatTime } from '@fastgpt/global/common/string/time';
|
||||||
import { useSystem } from '@fastgpt/web/hooks/useSystem';
|
import { useSystem } from '@fastgpt/web/hooks/useSystem';
|
||||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
|
||||||
import { useChatStore } from '@/web/core/chat/context/storeChat';
|
import { useChatStore } from '@/web/core/chat/context/storeChat';
|
||||||
|
import { useUserStore } from '@/web/support/user/useUserStore';
|
||||||
const HttpEditModal = dynamic(() => import('./HttpPluginEditModal'));
|
const HttpEditModal = dynamic(() => import('./HttpPluginEditModal'));
|
||||||
|
|
||||||
const ListItem = () => {
|
const ListItem = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { appT, commonT } = useI18n();
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { parentId = null } = router.query;
|
const { parentId = null } = router.query;
|
||||||
const { isPc } = useSystem();
|
const { isPc } = useSystem();
|
||||||
|
|
||||||
|
const { loadAndGetTeamMembers } = useUserStore();
|
||||||
const { lastChatAppId, setLastChatAppId } = useChatStore();
|
const { lastChatAppId, setLastChatAppId } = useChatStore();
|
||||||
|
|
||||||
const { myApps, loadMyApps, onUpdateApp, setMoveAppId, folderDetail } = useContextSelector(
|
const { myApps, loadMyApps, onUpdateApp, setMoveAppId, folderDetail } = useContextSelector(
|
||||||
@ -59,7 +58,6 @@ const ListItem = () => {
|
|||||||
const [editedApp, setEditedApp] = useState<EditResourceInfoFormType>();
|
const [editedApp, setEditedApp] = useState<EditResourceInfoFormType>();
|
||||||
const [editHttpPlugin, setEditHttpPlugin] = useState<EditHttpPluginProps>();
|
const [editHttpPlugin, setEditHttpPlugin] = useState<EditHttpPluginProps>();
|
||||||
const [editPerAppIndex, setEditPerAppIndex] = useState<number>();
|
const [editPerAppIndex, setEditPerAppIndex] = useState<number>();
|
||||||
const { feConfigs } = useSystemStore();
|
|
||||||
|
|
||||||
const editPerApp = useMemo(
|
const editPerApp = useMemo(
|
||||||
() => (editPerAppIndex !== undefined ? myApps[editPerAppIndex] : undefined),
|
() => (editPerAppIndex !== undefined ? myApps[editPerAppIndex] : undefined),
|
||||||
@ -100,18 +98,18 @@ const ListItem = () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const { openConfirm: openConfirmCopy, ConfirmModal: ConfirmCopyModal } = useConfirm({
|
const { openConfirm: openConfirmCopy, ConfirmModal: ConfirmCopyModal } = useConfirm({
|
||||||
content: appT('confirm_copy_app_tip')
|
content: t('app:confirm_copy_app_tip')
|
||||||
});
|
});
|
||||||
const { runAsync: onclickCopy } = useRequest2(postCopyApp, {
|
const { runAsync: onclickCopy } = useRequest2(postCopyApp, {
|
||||||
onSuccess({ appId }) {
|
onSuccess({ appId }) {
|
||||||
router.push(`/app/detail?appId=${appId}`);
|
router.push(`/app/detail?appId=${appId}`);
|
||||||
loadMyApps();
|
loadMyApps();
|
||||||
},
|
},
|
||||||
successToast: appT('create_copy_success')
|
successToast: t('app:create_copy_success')
|
||||||
});
|
});
|
||||||
|
|
||||||
const { data: members = [] } = useRequest2(getTeamMembers, {
|
const { data: members = [] } = useRequest2(loadAndGetTeamMembers, {
|
||||||
manual: !feConfigs.isPlus
|
manual: false
|
||||||
});
|
});
|
||||||
|
|
||||||
const { runAsync: onResumeInheritPermission } = useRequest2(
|
const { runAsync: onResumeInheritPermission } = useRequest2(
|
||||||
@ -120,7 +118,7 @@ const ListItem = () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
manual: true,
|
manual: true,
|
||||||
errorToast: commonT('permission.Resume InheritPermission Failed'),
|
errorToast: t('common:permission.Resume InheritPermission Failed'),
|
||||||
onSuccess() {
|
onSuccess() {
|
||||||
loadMyApps();
|
loadMyApps();
|
||||||
}
|
}
|
||||||
@ -267,7 +265,7 @@ const ListItem = () => {
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
icon: 'core/chat/chatLight',
|
icon: 'core/chat/chatLight',
|
||||||
label: appT('go_to_chat'),
|
label: t('app:go_to_chat'),
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
router.push(`/chat?appId=${app._id}`);
|
router.push(`/chat?appId=${app._id}`);
|
||||||
}
|
}
|
||||||
@ -282,7 +280,7 @@ const ListItem = () => {
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
icon: 'core/chat/chatLight',
|
icon: 'core/chat/chatLight',
|
||||||
label: appT('go_to_run'),
|
label: t('app:go_to_run'),
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
router.push(`/chat?appId=${app._id}`);
|
router.push(`/chat?appId=${app._id}`);
|
||||||
}
|
}
|
||||||
@ -342,7 +340,7 @@ const ListItem = () => {
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
icon: 'copy',
|
icon: 'copy',
|
||||||
label: appT('copy_one_app'),
|
label: t('app:copy_one_app'),
|
||||||
onClick: () =>
|
onClick: () =>
|
||||||
openConfirmCopy(() => onclickCopy({ appId: app._id }))()
|
openConfirmCopy(() => onclickCopy({ appId: app._id }))()
|
||||||
}
|
}
|
||||||
@ -363,8 +361,8 @@ const ListItem = () => {
|
|||||||
() => onclickDelApp(app._id),
|
() => onclickDelApp(app._id),
|
||||||
undefined,
|
undefined,
|
||||||
app.type === AppTypeEnum.folder
|
app.type === AppTypeEnum.folder
|
||||||
? appT('confirm_delete_folder_tip')
|
? t('app:confirm_delete_folder_tip')
|
||||||
: appT('confirm_del_app_tip')
|
: t('app:confirm_del_app_tip')
|
||||||
)()
|
)()
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import { FeTeamPlanStatusType } from '@fastgpt/global/support/wallet/sub/type';
|
|||||||
import { getTeamPlanStatus } from './team/api';
|
import { getTeamPlanStatus } from './team/api';
|
||||||
import { getTeamMembers } from '@/web/support/user/team/api';
|
import { getTeamMembers } from '@/web/support/user/team/api';
|
||||||
import { TeamMemberItemType } from '@fastgpt/global/support/user/team/type';
|
import { TeamMemberItemType } from '@fastgpt/global/support/user/team/type';
|
||||||
|
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
systemMsgReadId: string;
|
systemMsgReadId: string;
|
||||||
@ -22,7 +23,7 @@ type State = {
|
|||||||
initTeamPlanStatus: () => Promise<any>;
|
initTeamPlanStatus: () => Promise<any>;
|
||||||
|
|
||||||
teamMembers: TeamMemberItemType[];
|
teamMembers: TeamMemberItemType[];
|
||||||
loadAndGetTeamMembers: () => Promise<TeamMemberItemType[]>;
|
loadAndGetTeamMembers: (init?: boolean) => Promise<TeamMemberItemType[]>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const useUserStore = create<State>()(
|
export const useUserStore = create<State>()(
|
||||||
@ -85,8 +86,12 @@ export const useUserStore = create<State>()(
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
teamMembers: [],
|
teamMembers: [],
|
||||||
loadAndGetTeamMembers: async () => {
|
loadAndGetTeamMembers: async (init = false) => {
|
||||||
if (get().teamMembers.length) return Promise.resolve(get().teamMembers);
|
if (!useSystemStore.getState()?.feConfigs?.isPlus) return [];
|
||||||
|
|
||||||
|
const randomRefresh = Math.random() > 0.7;
|
||||||
|
if (!randomRefresh && !init && get().teamMembers.length)
|
||||||
|
return Promise.resolve(get().teamMembers);
|
||||||
|
|
||||||
const res = await getTeamMembers();
|
const res = await getTeamMembers();
|
||||||
set((state) => {
|
set((state) => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user