UNPKG

@nhost/react

Version:

Nhost React library

36 lines (35 loc) 1.18 kB
import { ChangeEmailHandlerResult, ChangeEmailOptions, ChangeEmailState } from '@nhost/nhost-js'; interface ChangeEmailHandler { (email: string, options?: ChangeEmailOptions): Promise<ChangeEmailHandlerResult>; } export interface ChangeEmailHookResult extends ChangeEmailState { /** Requests the email change. Returns a promise with the current context */ changeEmail: ChangeEmailHandler; } /** * Use the hook `useChangeEmail` to change email for the user. * * @example * ```tsx * const { changeEmail, isLoading, needsEmailVerification, isError, error } = useChangeEmail(); * * console.log({ isLoading, needsEmailVerification, isError, error }); * * const handleFormSubmit = async (e) => { * e.preventDefault(); * * await changeEmail('new@example.com') * } * ``` * * @docs https://docs.nhost.io/reference/react/use-change-email */ export declare function useChangeEmail(options?: ChangeEmailOptions): { changeEmail: ChangeEmailHandler; isLoading: boolean; needsEmailVerification: boolean; isError: boolean; error: import('@nhost/nhost-js').AuthErrorPayload | null; }; export {}; //# sourceMappingURL=useChangeEmail.d.ts.map