import { Form, FormField, FormButtons, FormSubmitButton, TextField, Button, } from '@umami/react-zen'; import { getRandomChars } from '@/lib/generate'; import { useMessages, useTeam, useUpdateQuery } from '@/components/hooks'; const generateId = () => `team_${getRandomChars(16)}`; export function TeamEditForm({ teamId, allowEdit, onSave, }: { teamId: string; allowEdit?: boolean; onSave?: () => void; }) { const team = useTeam(); const { formatMessage, labels, messages, getErrorMessage } = useMessages(); const { mutate, error, isPending, touch, toast } = useUpdateQuery(`/teams/${teamId}`); const handleSubmit = async (data: any) => { mutate(data, { onSuccess: async () => { toast(formatMessage(messages.saved)); touch('teams'); touch(`teams:${teamId}`); onSave?.(); }, }); }; return (
); }