mirror of https://github.com/buster-so/buster.git
refetch after user default access changed (#58)
This commit is contained in:
parent
bc36758fea
commit
db43289d71
|
@ -4,14 +4,16 @@ import { Text, Title } from '@/components/text';
|
||||||
import { Card, Select } from 'antd';
|
import { Card, Select } from 'antd';
|
||||||
import { useMemoizedFn } from 'ahooks';
|
import { useMemoizedFn } from 'ahooks';
|
||||||
|
|
||||||
export const UserDefaultAccess: React.FC<{ user: OrganizationUser; isAdmin: boolean }> = ({
|
export const UserDefaultAccess: React.FC<{
|
||||||
user,
|
user: OrganizationUser;
|
||||||
isAdmin
|
isAdmin: boolean;
|
||||||
}) => {
|
refetchUser: () => void;
|
||||||
|
}> = ({ user, isAdmin, refetchUser }) => {
|
||||||
const { mutateAsync, isPending } = useUpdateUser();
|
const { mutateAsync, isPending } = useUpdateUser();
|
||||||
|
|
||||||
const onChange = useMemoizedFn((value: string) => {
|
const onChange = useMemoizedFn(async (value: string) => {
|
||||||
mutateAsync({ userId: user.id, role: value as OrganizationUser['role'] });
|
await mutateAsync({ userId: user.id, role: value as OrganizationUser['role'] });
|
||||||
|
refetchUser();
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -8,14 +8,14 @@ import { UserLineageHeader } from './UserLineageHeader';
|
||||||
import { UserDatasetSearch } from './UserDatasetSearch';
|
import { UserDatasetSearch } from './UserDatasetSearch';
|
||||||
|
|
||||||
export const UserOverviewController = React.memo(({ userId }: { userId: string }) => {
|
export const UserOverviewController = React.memo(({ userId }: { userId: string }) => {
|
||||||
const { data: user } = useGetUser({ userId });
|
const { data: user, refetch: refetchUser } = useGetUser({ userId });
|
||||||
const isAdmin = useUserConfigContextSelector((x) => x.isAdmin);
|
const isAdmin = useUserConfigContextSelector((x) => x.isAdmin);
|
||||||
|
|
||||||
if (!user) return null;
|
if (!user) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<UserDefaultAccess user={user} isAdmin={isAdmin} />
|
<UserDefaultAccess user={user} isAdmin={isAdmin} refetchUser={refetchUser} />
|
||||||
<UserLineageHeader className="!mt-[48px]" user={user} />
|
<UserLineageHeader className="!mt-[48px]" user={user} />
|
||||||
<UserDatasetSearch user={user} />
|
<UserDatasetSearch user={user} />
|
||||||
</>
|
</>
|
||||||
|
|
Loading…
Reference in New Issue