2023-04-02 21:24:50 +02:00
|
|
|
import useApi from 'hooks/useApi';
|
|
|
|
import useMessages from 'hooks/useMessages';
|
|
|
|
import { Icon, Icons, LoadingButton, Text } from 'react-basics';
|
|
|
|
|
2023-04-21 17:00:42 +02:00
|
|
|
export function TeamWebsiteRemoveButton({ teamId, websiteId, onSave }) {
|
2023-04-02 21:24:50 +02:00
|
|
|
const { formatMessage, labels } = useMessages();
|
|
|
|
const { del, useMutation } = useApi();
|
2023-04-10 01:04:28 +02:00
|
|
|
const { mutate, isLoading } = useMutation(() => del(`/teams/${teamId}/websites/${websiteId}`));
|
2023-04-02 21:24:50 +02:00
|
|
|
|
|
|
|
const handleRemoveTeamMember = () => {
|
|
|
|
mutate(
|
2023-04-10 01:04:28 +02:00
|
|
|
{},
|
2023-04-02 21:24:50 +02:00
|
|
|
{
|
|
|
|
onSuccess: () => {
|
|
|
|
onSave();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
|
|
<LoadingButton onClick={() => handleRemoveTeamMember()} loading={isLoading}>
|
|
|
|
<Icon>
|
|
|
|
<Icons.Close />
|
|
|
|
</Icon>
|
|
|
|
<Text>{formatMessage(labels.remove)}</Text>
|
|
|
|
</LoadingButton>
|
|
|
|
);
|
|
|
|
}
|
2023-04-21 17:00:42 +02:00
|
|
|
|
|
|
|
export default TeamWebsiteRemoveButton;
|