ChangePasswordForm
Change the password: current + new (twice), re-authenticated.
import { ChangePasswordForm } from "@evolve-storefront/feature-account/change-password-form";Renders inside AccountProvider.
Preview
Usage
const { formProps } = useChangePasswordForm({ onPasswordChanged: close });
// The confirmation is checked here and dropped before the mutation runs.<ChangePasswordForm {...formProps} onCancel={close} />;Props
| Prop | Type | Description |
|---|---|---|
onValidSubmit | (values: { password: string; newPassword: string; }) => void | Runs with the current + new password on a valid submit (confirm dropped). |
validationBehavior? | "aria" | "native" | Default |
isPending? | boolean | |
error? | string | null | |
serverErrors? | FormValidationErrors | |
onCancel? | (() => void) |
Any other props go to the root element, like on a plain HTML element.
Examples
With ErrorWrong current password (server error surfaced form-level).
// `useChangePasswordForm` maps a wrong current password into formProps.error.<ChangePasswordForm onValidSubmit={change} error={errorMessage} />;
