Changed route ids to be more explicit.

This commit is contained in:
Mike Cao 2024-01-29 14:47:52 -08:00
parent 1a70350936
commit 18e36aa7b3
105 changed files with 86 additions and 76 deletions

View file

@ -1,45 +0,0 @@
import { useApi, useMessages } from 'components/hooks';
import { Icon, Icons, LoadingButton, Text } from 'react-basics';
import { setValue } from 'store/cache';
export function TeamMemberRemoveButton({
teamId,
userId,
disabled,
onSave,
}: {
teamId: string;
userId: string;
disabled?: boolean;
onSave?: () => void;
}) {
const { formatMessage, labels } = useMessages();
const { del, useMutation } = useApi();
const { mutate, isPending } = useMutation({
mutationFn: () => del(`/teams/${teamId}/users/${userId}`),
});
const handleRemoveTeamMember = () => {
mutate(null, {
onSuccess: () => {
setValue('team:members', Date.now());
onSave?.();
},
});
};
return (
<LoadingButton
onClick={() => handleRemoveTeamMember()}
disabled={disabled}
isLoading={isPending}
>
<Icon>
<Icons.Close />
</Icon>
<Text>{formatMessage(labels.remove)}</Text>
</LoadingButton>
);
}
export default TeamMemberRemoveButton;