UNPKG

@nhost/react

Version:

Nhost React library

37 lines (36 loc) 1.4 kB
import { ResetPasswordHandlerResult, ResetPasswordOptions, ResetPasswordState } from '@nhost/nhost-js'; interface ResetPasswordHandler { (email: string, options?: ResetPasswordOptions): Promise<ResetPasswordHandlerResult>; } export interface ResetPasswordHookResult extends ResetPasswordState { /** * Sends an email with a temporary connection link. Returns a promise with the current context */ resetPassword: ResetPasswordHandler; } interface ResetPasswordHook { (options?: ResetPasswordOptions): ResetPasswordHookResult; } /** * Use the hook `useResetPassword` to reset the password for a user. This will send a reset password link in an email to the user. When the user clicks on the reset-password link the user is automatically signed in and can change their password using the hook `useChangePassword`. * * @example * ```tsx * const { resetPassword, isLoading, isSent, isError, error } = useResetPassword(); * * console.log({ isLoading, isSent, isError, error }); * * const handleFormSubmit = async (e) => { * e.preventDefault(); * * await resetPassword('joe@example.com', { * redirectTo: 'http://localhost:3000/settings/change-password' * }) * } * ``` * * @docs https://docs.nhost.io/reference/react/use-reset-password */ export declare const useResetPassword: ResetPasswordHook; export {}; //# sourceMappingURL=useResetPassword.d.ts.map