mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 13:03:50 +00:00
fix: refresh memberlist when switching account (#3814)
This commit is contained in:
@@ -13,9 +13,11 @@ import { useRouter } from 'next/router';
|
|||||||
|
|
||||||
const TeamSelector = ({
|
const TeamSelector = ({
|
||||||
showManage,
|
showManage,
|
||||||
|
afterSwitchTeam,
|
||||||
...props
|
...props
|
||||||
}: ButtonProps & {
|
}: ButtonProps & {
|
||||||
showManage?: boolean;
|
showManage?: boolean;
|
||||||
|
afterSwitchTeam?: () => void;
|
||||||
}) => {
|
}) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -36,6 +38,7 @@ const TeamSelector = ({
|
|||||||
{
|
{
|
||||||
onFinally: () => {
|
onFinally: () => {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
afterSwitchTeam?.();
|
||||||
},
|
},
|
||||||
errorToast: t('common:user.team.Switch Team Failed')
|
errorToast: t('common:user.team.Switch Team Failed')
|
||||||
}
|
}
|
||||||
|
@@ -110,7 +110,7 @@ const MyInfo = ({ onOpenContact }: { onOpenContact: () => void }) => {
|
|||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const { feConfigs } = useSystemStore();
|
const { feConfigs } = useSystemStore();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { userInfo, updateUserInfo, teamPlanStatus } = useUserStore();
|
const { userInfo, updateUserInfo, teamPlanStatus, initUserInfo } = useUserStore();
|
||||||
const { reset } = useForm<UserUpdateParams>({
|
const { reset } = useForm<UserUpdateParams>({
|
||||||
defaultValues: userInfo as UserType
|
defaultValues: userInfo as UserType
|
||||||
});
|
});
|
||||||
@@ -284,7 +284,7 @@ const MyInfo = ({ onOpenContact }: { onOpenContact: () => void }) => {
|
|||||||
<Flex mt={6} alignItems={'center'}>
|
<Flex mt={6} alignItems={'center'}>
|
||||||
<Box {...labelStyles}>{t('account_info:user_team_team_name')}: </Box>
|
<Box {...labelStyles}>{t('account_info:user_team_team_name')}: </Box>
|
||||||
<Flex flex={'1 0 0'} w={0} align={'center'}>
|
<Flex flex={'1 0 0'} w={0} align={'center'}>
|
||||||
<TeamSelector height={'28px'} w={'100%'} showManage />
|
<TeamSelector height={'28px'} w={'100%'} showManage afterSwitchTeam={initUserInfo} />
|
||||||
</Flex>
|
</Flex>
|
||||||
</Flex>
|
</Flex>
|
||||||
)}
|
)}
|
||||||
|
@@ -35,7 +35,10 @@ const Team = () => {
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { userInfo } = useUserStore();
|
const { userInfo } = useUserStore();
|
||||||
|
|
||||||
const { setEditTeamData, isLoading, teamSize } = useContextSelector(TeamContext, (v) => v);
|
const { setEditTeamData, isLoading, teamSize, refetchMembers } = useContextSelector(
|
||||||
|
TeamContext,
|
||||||
|
(v) => v
|
||||||
|
);
|
||||||
|
|
||||||
const Tabs = useMemo(
|
const Tabs = useMemo(
|
||||||
() => (
|
() => (
|
||||||
@@ -85,7 +88,7 @@ const Team = () => {
|
|||||||
</Box>
|
</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
<Flex align={'center'} ml={6}>
|
<Flex align={'center'} ml={6}>
|
||||||
<TeamSelector height={'28px'} />
|
<TeamSelector height={'28px'} afterSwitchTeam={refetchMembers} />
|
||||||
</Flex>
|
</Flex>
|
||||||
{userInfo?.team?.role === TeamMemberRoleEnum.owner && (
|
{userInfo?.team?.role === TeamMemberRoleEnum.owner && (
|
||||||
<Flex align={'center'} justify={'center'} ml={2} p={'0.44rem'}>
|
<Flex align={'center'} justify={'center'} ml={2} p={'0.44rem'}>
|
||||||
|
Reference in New Issue
Block a user