diff --git a/frontend/pages/Profile.tsx b/frontend/pages/Profile.tsx index e11aac3..79e0ec0 100644 --- a/frontend/pages/Profile.tsx +++ b/frontend/pages/Profile.tsx @@ -8,6 +8,7 @@ import { Button } from "../components/Button"; import { useAuth } from "../contexts/AuthContext"; import { getFunctions, createProfessional, updateProfessional } from "../services/apiService"; import { toast } from "react-hot-toast"; +import { formatCPFCNPJ, formatPhone } from "../utils/masks"; // --- Helper Components --- @@ -297,7 +298,7 @@ export const ProfilePage: React.FC = () => { res = await createProfessional(payload, token); } else { // UPDATE - res = await updateProfessional(formData.id, payload, token); + res = await updateProfessional(formData.id, payload, token); } if (res.error) throw new Error(res.error); @@ -473,7 +474,8 @@ export const ProfilePage: React.FC = () => { label="CPF/CNPJ" icon={FileText} value={formData.cpf_cnpj_titular || ""} - onChange={(e) => handleChange("cpf_cnpj_titular", e.target.value)} + onChange={(e) => handleChange("cpf_cnpj_titular", formatCPFCNPJ(e.target.value))} + maxLength={18} /> @@ -495,7 +497,8 @@ export const ProfilePage: React.FC = () => { label="WhatsApp" icon={Phone} value={formData.whatsapp || ""} - onChange={(e) => handleChange("whatsapp", e.target.value)} + onChange={(e) => handleChange("whatsapp", formatPhone(e.target.value))} + maxLength={15} />