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 { useMemoizedFn } from 'ahooks';
|
||||
|
||||
export const UserDefaultAccess: React.FC<{ user: OrganizationUser; isAdmin: boolean }> = ({
|
||||
user,
|
||||
isAdmin
|
||||
}) => {
|
||||
export const UserDefaultAccess: React.FC<{
|
||||
user: OrganizationUser;
|
||||
isAdmin: boolean;
|
||||
refetchUser: () => void;
|
||||
}> = ({ user, isAdmin, refetchUser }) => {
|
||||
const { mutateAsync, isPending } = useUpdateUser();
|
||||
|
||||
const onChange = useMemoizedFn((value: string) => {
|
||||
mutateAsync({ userId: user.id, role: value as OrganizationUser['role'] });
|
||||
const onChange = useMemoizedFn(async (value: string) => {
|
||||
await mutateAsync({ userId: user.id, role: value as OrganizationUser['role'] });
|
||||
refetchUser();
|
||||
});
|
||||
|
||||
return (
|
||||
|
|
|
@ -8,14 +8,14 @@ import { UserLineageHeader } from './UserLineageHeader';
|
|||
import { UserDatasetSearch } from './UserDatasetSearch';
|
||||
|
||||
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);
|
||||
|
||||
if (!user) return null;
|
||||
|
||||
return (
|
||||
<>
|
||||
<UserDefaultAccess user={user} isAdmin={isAdmin} />
|
||||
<UserDefaultAccess user={user} isAdmin={isAdmin} refetchUser={refetchUser} />
|
||||
<UserLineageHeader className="!mt-[48px]" user={user} />
|
||||
<UserDatasetSearch user={user} />
|
||||
</>
|
||||
|
|
Loading…
Reference in New Issue