import type { FunctionComponent } from "react"; import { useEffect } from "react"; import { useMutation } from "blitz"; import { useForm } from "react-hook-form"; import updateUser from "../../mutations/update-user"; import Alert from "../../../core/components/alert"; import Button from "../button"; import SettingsSection from "../settings-section"; import useCurrentUser from "../../../core/hooks/use-current-user"; import appLogger from "../../../../integrations/logger"; type Form = { fullName: string; email: string; }; const logger = appLogger.child({ module: "profile-settings" }); const ProfileInformations: FunctionComponent = () => { const { user } = useCurrentUser(); const [updateUserMutation, { error, isError, isSuccess }] = useMutation(updateUser); const { register, handleSubmit, setValue, formState: { isSubmitting }, } = useForm
); }; export default ProfileInformations; function parseErrorMessage(error: Error | null): string { if (!error) { return ""; } if (error.name === "ZodError") { return JSON.parse(error.message)[0].message; } return error.message; }