import { Button, Form, FormButtons, SubmitButton } from 'react-basics'; import useApi from 'components/hooks/useApi'; import useMessages from 'components/hooks/useMessages'; import { setValue } from 'store/cache'; export function TeamLeaveForm({ teamId, userId, teamName, onSave, onClose, }: { teamId: string; userId: string; teamName: string; onSave: () => void; onClose: () => void; }) { const { formatMessage, labels, messages, FormattedMessage } = useMessages(); const { del, useMutation } = useApi(); const { mutate, error, isPending } = useMutation({ mutationFn: () => del(`/teams/${teamId}/users/${userId}`), }); const handleSubmit = async () => { mutate(null, { onSuccess: async () => { setValue('team:members', Date.now()); onSave(); onClose(); }, }); }; return (
); } export default TeamLeaveForm;