@nhost/react
Version:
Nhost React library
33 lines (32 loc) • 1.1 kB
TypeScript
import { ActionErrorState, ActionLoadingState, ActionSuccessState, ChangePasswordHandlerResult } from '@nhost/nhost-js';
interface ChangePasswordHandler {
(password: string): Promise<ChangePasswordHandlerResult>;
}
export interface ChangePasswordHookResult extends ActionErrorState, ActionLoadingState, ActionSuccessState {
/** Requests the password change. Returns a promise with the current context */
changePassword: ChangePasswordHandler;
}
interface ChangePasswordHook {
(): ChangePasswordHookResult;
}
/**
* Use the hook `useChangePassword` to change password for the user.
*
* @example
* ```tsx
* const { changePassword, isLoading, isSuccess, isError, error } = useChangePassword();
*
* console.log({ isLoading, isSuccess, isError, error });
*
* const handleFormSubmit = async (e) => {
* e.preventDefault();
*
* await changePassword('my-new-password')
* }
* ```
*
* @docs https://docs.nhost.io/reference/react/use-change-password
*/
export declare const useChangePassword: ChangePasswordHook;
export {};
//# sourceMappingURL=useChangePassword.d.ts.map