diff --git a/docs/react/auth/hooks/useDeleteUserMutation.mdx b/docs/react/auth/hooks/useDeleteUserMutation.mdx
index 84cdb4b..fd3a0da 100644
--- a/docs/react/auth/hooks/useDeleteUserMutation.mdx
+++ b/docs/react/auth/hooks/useDeleteUserMutation.mdx
@@ -2,4 +2,92 @@
title: useDeleteUserMutation
---
-This hook is implemented, but the documentation is a work in progress, check back soon.
\ No newline at end of file
+The `useDeleteUserMutation` hook simplifies the process of deleting a user from Firebase Authentication.
+It provides built-in state management for handling the mutation lifecycle (e.g., loading, success, error) and supports custom behaviors like `onSuccess` or `onError`.
+
+## Features
+
+- **Easy Firebase Auth Integration**: Leverages Firebase's `deleteUser` functionality.
+- **Built-in State Management**: Automatically manages `idle`, `loading`, `success`, and `error` states.
+- **Customizable Callbacks**: Supports `onSuccess`, `onError`, and other TanStack Query mutation options.
+- **Optimized for TanStack Query**: Seamlessly integrates with TanStack Query for caching and refetching strategies.
+
+## Installation
+
+Ensure you have the necessary Firebase, TanStack Query and TanStack Query Firebase packages installed:
+
+```bash
+npm install firebase @tanstack/react-query @tanstack-query-firebase/react
+```
+
+## Usage
+
+```jsx
+import { useDeleteUserMutation } from "@tanstack-query-firebase/react/auth";
+
+function Component() {
+ const { mutate, isPending, isSuccess, isError, error } =
+ useDeleteUserMutation();
+
+ const handleDeleteUser = () => {
+ const user = auth.currentUser;
+ if (user) {
+ mutate(user);
+ }
+ };
+
+ return (
+
+ {isPending &&
Deleting user...
}
+ {isSuccess &&
User deleted successfully!
}
+ {isError &&
Error: {error.message}
}
+
+
+
+ );
+}
+```
+
+## API Reference
+
+`useDeleteUserMutation(options?)`
+
+### Parameters
+
+- `options` (optional):
+ Object for customizing mutation behavior. Accepts all options supported by TanStack Query's `useMutation`, such as:
+ - `onSuccess`: Callback fired when the mutation succeeds.
+ - `onError`: Callback fired when the mutation fails.
+ - `onSettled`: Callback fired after the mutation finishes, regardless of success or failure.
+
+See [useMutation](https://tanstack.com/query/latest/docs/react/reference/useMutation) for more information on mutation options and behavior.
+
+### Returns
+
+An object containing the following properties, provided by TanStack Query's [useMutation](https://tanstack.com/query/latest/docs/react/reference/useMutation):
+
+- `mutate`:
+ Function to trigger the mutation. In this case, it deletes the user.
+
+```ts
+mutate(user: User): void;
+```
+
+- `isPending`:
+ Boolean indicating if the mutation is in progress (alias for `isLoading`).
+
+- `isSuccess`:
+ Boolean indicating if the mutation has successfully completed.
+
+- `isError`:
+ Boolean indicating if the mutation has failed.
+
+- `error`:
+ The error object, if the mutation failed.
+
+- `data`:
+ The result of the mutation (typically `undefined` for delete operations).
+
+For a complete list of returned properties, see the official TanStack Query [useMutation](https://tanstack.com/query/latest/docs/react/reference/useMutation) documentation.
diff --git a/docs/react/auth/hooks/useReloadMutation.mdx b/docs/react/auth/hooks/useReloadMutation.mdx
index 8af6f32..128147d 100644
--- a/docs/react/auth/hooks/useReloadMutation.mdx
+++ b/docs/react/auth/hooks/useReloadMutation.mdx
@@ -2,4 +2,91 @@
title: useReloadMutation
---
-This hook is implemented, but the documentation is a work in progress, check back soon.
\ No newline at end of file
+The `useReloadMutation` hook provides a simple way to reload user data in Firebase Authentication.
+This hook enables re-authenticating users and ensures the latest user state is fetched from Firebase.
+
+## Features
+
+- **Seamless Firebase Integration**: Reloads the current Firebase user to fetch updated user state.
+- **Built-in State Management**: Tracks the mutation lifecycle (`idle`, `loading`, `success`, `error`).
+- **Customizable Callbacks**: Supports `onSuccess`, `onError`, and other TanStack Query mutation options.
+- **Type-Safe Handling**: Ensures that only valid Firebase user objects can be passed.
+
+## Installation
+
+Ensure you have the necessary Firebase, TanStack Query and TanStack Query Firebase packages installed:
+
+```bash
+npm install firebase @tanstack/react-query @tanstack-query-firebase/react
+```
+
+## Usage
+
+```jsx
+import { useReloadMutation } from "@tanstack-query-firebase/react/auth";
+
+function Component() {
+ const { mutate, isPending, isSuccess, isError, error } = useReloadMutation();
+
+ const handleReloadUser = () => {
+ const user = auth.currentUser;
+ if (user) {
+ mutate(user);
+ }
+ };
+
+ return (
+
+ {isPending &&
Reloading user data...
}
+ {isSuccess &&
User data reloaded successfully!
}
+ {isError &&
Error: {error.message}
}
+
+
+
+ );
+}
+```
+
+## API Reference
+
+`useReloadMutation(options?)`
+
+### Parameters
+
+- `options` (optional):
+ An object for customizing the mutation behavior. Accepts all options supported by TanStack Query's `useMutation`, such as:
+ - `onSuccess`: Callback fired when the mutation succeeds.
+ - `onError`: Callback fired when the mutation fails.
+ - `onSettled`: Callback fired after the mutation finishes, regardless of success or failure.
+
+For a full list of supported options, see the TanStack Query [useMutation documentation](https://tanstack.com/query/latest/docs/react/reference/useMutation)
+
+### Returns
+
+The hook returns the following properties, provided by TanStack Query's [useMutation](https://tanstack.com/query/latest/docs/react/reference/useMutation):
+
+- `mutate`:
+ Function to trigger the mutation. In this case, it reloads the user data.
+
+```ts
+mutate(user: User): void;
+```
+
+- `isPending`:
+ Boolean indicating if the mutation is in progress (alias for `isLoading`).
+
+- `isSuccess`:
+ Boolean indicating if the mutation has successfully completed.
+
+- `isError`:
+ Boolean indicating if the mutation has failed.
+
+- `error`:
+ The error object, if the mutation failed.
+
+- `data`:
+ The result of the mutation (typically `undefined` for reload operations).
+
+For a complete list of returned properties, see the official TanStack Query [useMutation](https://tanstack.com/query/latest/docs/react/reference/useMutation) documentation.
diff --git a/docs/react/auth/hooks/useSignInAnonymouslyMutation.mdx b/docs/react/auth/hooks/useSignInAnonymouslyMutation.mdx
index 9abff67..21300e7 100644
--- a/docs/react/auth/hooks/useSignInAnonymouslyMutation.mdx
+++ b/docs/react/auth/hooks/useSignInAnonymouslyMutation.mdx
@@ -2,4 +2,89 @@
title: useSignInAnonymouslyMutation
---
-This hook is implemented, but the documentation is a work in progress, check back soon.
\ No newline at end of file
+The `useSignInAnonymouslyMutation` hook provides a simple way to sign in users anonymously using Firebase Authentication.
+This hook integrates Firebase’s `signInAnonymously` method with TanStack Query's mutation lifecycle, allowing seamless state management and error handling.
+
+## Features
+
+- **Firebase Authentication Integration**: Allows users to sign in anonymously with Firebase Authentication.
+- **Built-in State Management**: Tracks the mutation lifecycle (`idle`, `loading`, `success`, `error`).
+- **Customizable Callbacks**: Supports `onSuccess`, `onError`, and other TanStack Query mutation options.
+- **Type-Safe Handling**: Ensures only valid data is passed and received from Firebase Authentication.
+
+## Installation
+
+Ensure you have the necessary Firebase, TanStack Query and TanStack Query Firebase packages installed:
+
+```bash
+npm install firebase @tanstack/react-query @tanstack-query-firebase/react
+```
+
+## Usage
+
+```jsx
+import { useSignInAnonymouslyMutation } from "@tanstack-query-firebase/react/auth";
+
+function Component() {
+ const { mutate, isPending, isSuccess, isError, error } = useSignInAnonymouslyMutation(auth);
+
+ const handleSignIn = () => {
+ mutate(); // Trigger anonymous sign-in
+ };
+
+ return (
+
+ {isPending &&
Signing in...
}
+ {isSuccess &&
Signed in anonymously!
}
+ {isError &&
Error: {error?.message}
}
+
+
+
+ );
+}
+```
+
+## API Reference
+
+`useSignInAnonymouslyMutation(auth, options?)`
+
+### Parameters
+
+-`auth`: The Firebase `Auth` instance used to manage authentication.
+- `options` (optional):
+ An object for customizing the mutation behavior. Accepts all options supported by TanStack Query's `useMutation`, such as:
+ - `onSuccess`: Callback fired when the mutation succeeds.
+ - `onError`: Callback fired when the mutation fails.
+ - `onSettled`: Callback fired after the mutation finishes, regardless of success or failure.
+
+For a full list of supported options, see the TanStack Query [useMutation documentation](https://tanstack.com/query/latest/docs/react/reference/useMutation)
+
+### Returns
+
+The hook returns the following properties, provided by TanStack Query's [useMutation](https://tanstack.com/query/latest/docs/react/reference/useMutation):
+
+- `mutate`:
+ Function to trigger the mutation(signin anonymously).
+
+```ts
+mutate(): void;
+```
+
+- `isPending`:
+ Boolean indicating if the mutation is in progress (alias for `isLoading`).
+
+- `isSuccess`:
+ Boolean indicating if the mutation has successfully completed.
+
+- `isError`:
+ Boolean indicating if the mutation has failed.
+
+- `error`:
+ The error object, if the mutation failed.
+
+- `data`:
+ The result of the mutation, typically containing the authenticated user data.
+
+For a complete list of returned properties, see the official TanStack Query [useMutation](https://tanstack.com/query/latest/docs/react/reference/useMutation) documentation.
diff --git a/docs/react/auth/hooks/useSignInWithCredentialMutation.mdx b/docs/react/auth/hooks/useSignInWithCredentialMutation.mdx
index a69de7d..7aa98d9 100644
--- a/docs/react/auth/hooks/useSignInWithCredentialMutation.mdx
+++ b/docs/react/auth/hooks/useSignInWithCredentialMutation.mdx
@@ -2,4 +2,93 @@
title: useSignInWithCredentialMutation
---
-This hook is implemented, but the documentation is a work in progress, check back soon.
\ No newline at end of file
+The `useSignInWithCredentialMutation` hook is designed to handle user sign-ins using Firebase Authentication credentials, such as Google sign-in credentials.
+It integrates Firebase's `signInWithCredential` method with TanStack Query’s mutation lifecycle for easy state management and error handling.
+
+## Features
+
+- **Firebase Authentication Integration**: Simplifies signing in with any valid Firebase `AuthCredential` (e.g., Google, Facebook, etc.).
+- **Built-in State Management**: Tracks the mutation lifecycle (`idle`, `loading`, `success`, `error`).
+- **Customizable Callbacks**: Supports `onSuccess`, `onError`, and other TanStack Query mutation options.
+- **Type-Safe Handling**: Ensures type safety with TanStack Query and Firebase types.
+
+## Installation
+
+Ensure you have the necessary Firebase, TanStack Query and TanStack Query Firebase packages installed:
+
+```bash
+npm install firebase @tanstack/react-query @tanstack-query-firebase/react
+```
+
+## Usage
+
+```jsx
+import { useSignInWithCredentialMutation } from "@tanstack-query-firebase/react/auth";
+import { GoogleAuthProvider } from "firebase/auth";
+
+const authCredential = GoogleAuthProvider.credential("your-id-token");
+
+function SignInComponent() {
+ const { mutate, isPending, isSuccess, isError, error, data } = useSignInWithCredentialMutation(auth, authCredential);
+
+ const handleSignIn = () => {
+ mutate(); // Trigger the sign-in mutation
+ };
+
+ return (
+
+ {isPending &&
Signing in...
}
+ {isSuccess &&
Signed in as {data?.user.email}
}
+ {isError &&
Error: {error?.message}
}
+
+
+
+ );
+}
+```
+
+## API Reference
+
+`useSignInWithCredentialMutation(auth, credential, options?)`
+
+### Parameters
+
+- `auth`: The Firebase `Auth` instance used to manage authentication.
+- `credential`: An instance of `AuthCredential` (e.g., `GoogleAuthProvider.credential`).
+- `options` (optional):
+ An object for customizing the mutation behavior. Accepts all options supported by TanStack Query's `useMutation`, such as:
+ - `onSuccess`: Callback fired when the mutation succeeds.
+ - `onError`: Callback fired when the mutation fails.
+ - `onSettled`: Callback fired after the mutation finishes, regardless of success or failure.
+
+For a full list of supported options, see the TanStack Query [useMutation documentation](https://tanstack.com/query/latest/docs/react/reference/useMutation)
+
+### Returns
+
+The hook returns the following properties, provided by TanStack Query's [useMutation](https://tanstack.com/query/latest/docs/react/reference/useMutation):
+
+- `mutate`:
+ Function to trigger the sign-in mutation with the provided credential.
+
+```ts
+mutate(): void;
+```
+
+- `isPending`:
+ Boolean indicating if the mutation is in progress (alias for `isLoading`).
+
+- `isSuccess`:
+ Boolean indicating if the mutation has successfully completed.
+
+- `isError`:
+ Boolean indicating if the mutation has failed.
+
+- `error`:
+ The error object, if the mutation failed.
+
+- `data`:
+ The result of the sign-in, typically containing the authenticated `user` object.
+
+For a complete list of returned properties, see the official TanStack Query [useMutation](https://tanstack.com/query/latest/docs/react/reference/useMutation) documentation.
diff --git a/docs/react/auth/hooks/useSignInWithEmailAndPasswordMutation.mdx b/docs/react/auth/hooks/useSignInWithEmailAndPasswordMutation.mdx
index 1975bdb..48309a3 100644
--- a/docs/react/auth/hooks/useSignInWithEmailAndPasswordMutation.mdx
+++ b/docs/react/auth/hooks/useSignInWithEmailAndPasswordMutation.mdx
@@ -2,4 +2,90 @@
title: useSignInWithEmailAndPasswordMutation
---
-This hook is implemented, but the documentation is a work in progress, check back soon.
\ No newline at end of file
+The `useSignInWithEmailAndPasswordMutation` hook is designed to handle user sign-ins using Firebase Authentication with email and password.
+It integrates Firebase's `signInWithEmailAndPassword` method with TanStack Query’s mutation lifecycle for easy state management and error handling.
+
+## Features
+
+- **Firebase Authentication Integration**: Simplifies signing in with email and password using Firebase's `signInWithEmailAndPassword` method.
+- **Built-in State Management**: Tracks the mutation lifecycle (`idle`, `loading`, `success`, `error`).
+- **Customizable Callbacks**: Supports `onSuccess`, `onError`, and other TanStack Query mutation options.
+- **Type-Safe Handling**: Ensures type safety with TanStack Query and Firebase types.
+
+## Installation
+
+Ensure you have the necessary Firebase, TanStack Query and TanStack Query Firebase packages installed:
+
+```bash
+npm install firebase @tanstack/react-query @tanstack-query-firebase/react
+```
+
+## Usage
+
+```jsx
+import { useSignInWithEmailAndPasswordMutation } from "./useSignInWithEmailAndPasswordMutation";
+
+function SignInComponent() {
+ const { mutate, isPending, isSuccess, isError, error, data } = useSignInWithEmailAndPasswordMutation(auth);
+
+ const handleSignIn = () => {
+ const email = "user@example.com";
+ const password = "password123";
+ mutate({ email, password }); // Trigger the sign-in mutation
+ };
+
+ return (
+
+ {isPending &&
Signing in...
}
+ {isSuccess &&
Signed in as {data?.user.email}
}
+ {isError &&
Error: {error?.message}
}
+
+
+
+ );
+}
+```
+
+## API Reference
+
+`useSignInWithEmailAndPasswordMutation(auth, options?)`
+
+### Parameters
+
+- `auth`: The Firebase `Auth` instance used to manage authentication.
+- `options` (optional):
+ An object for customizing the mutation behavior. Accepts all options supported by TanStack Query's `useMutation`, such as:
+ - `onSuccess`: Callback fired when the mutation succeeds.
+ - `onError`: Callback fired when the mutation fails.
+ - `onSettled`: Callback fired after the mutation finishes, regardless of success or failure.
+
+For a full list of supported options, see the TanStack Query [useMutation documentation](https://tanstack.com/query/latest/docs/react/reference/useMutation)
+
+### Returns
+
+The hook returns the following properties, provided by TanStack Query's [useMutation](https://tanstack.com/query/latest/docs/react/reference/useMutation):
+
+- `mutate({ email, password })`: Function to trigger the sign-in mutation with the provided email and password.
+
+```ts
+mutate({ email: string, password: string }): void;
+```
+
+- `isPending`:
+ Boolean indicating if the mutation is in progress (alias for `isLoading`).
+
+- `isSuccess`:
+ Boolean indicating if the mutation has successfully completed.
+
+- `isError`:
+ Boolean indicating if the mutation has failed.
+
+- `error`:
+ The error object, if the mutation failed.
+
+- `data`:
+ The result of the mutation, which contains the `UserCredential` object if the mutation was successful.
+
+For a complete list of returned properties, see the official TanStack Query [useMutation](https://tanstack.com/query/latest/docs/react/reference/useMutation) documentation.
diff --git a/docs/react/auth/hooks/useSignOutMutation.mdx b/docs/react/auth/hooks/useSignOutMutation.mdx
index de9a553..7f8883a 100644
--- a/docs/react/auth/hooks/useSignOutMutation.mdx
+++ b/docs/react/auth/hooks/useSignOutMutation.mdx
@@ -2,4 +2,88 @@
title: useSignOutMutation
---
-This hook is implemented, but the documentation is a work in progress, check back soon.
\ No newline at end of file
+The `useSignOutMutation` hook is designed to handle user sign-out using Firebase Authentication.
+It integrates Firebase's `signOut` method with TanStack Query’s mutation lifecycle for easy state management and error handling.
+
+## Features
+
+- **Firebase Authentication Integration**: Simplifies signing out users from Firebase Authentication using Firebase's `signOut` method.
+- **Built-in State Management**: Tracks the mutation lifecycle (`idle`, `loading`, `success`, `error`).
+- **Customizable Callbacks**: Supports `onSuccess`, `onError`, and other TanStack Query mutation options.
+- **Type-Safe Handling**: Ensures type safety with TanStack Query and Firebase types.
+
+## Installation
+
+Ensure you have the necessary Firebase, TanStack Query and TanStack Query Firebase packages installed:
+
+```bash
+npm install firebase @tanstack/react-query @tanstack-query-firebase/react
+```
+
+## Usage
+
+```jsx
+import { useSignOutMutation } from "./useSignOutMutation";
+
+function SignOutComponent() {
+ const { mutate, isPending, isSuccess, isError, error } = useSignOutMutation(auth);
+
+ const handleSignOut = () => {
+ mutate(); // Trigger the sign-out mutation
+ };
+
+ return (
+
+ {isPending &&
Signing out...
}
+ {isSuccess &&
Signed out successfully!
}
+ {isError &&
Error: {error?.message}
}
+
+
+
+ );
+}
+```
+
+## API Reference
+
+`useSignOutMutation(auth, options?)`
+
+### Parameters
+
+- `auth`: The Firebase `Auth` instance used to manage authentication.
+- `options` (optional):
+ An object for customizing the mutation behavior. Accepts all options supported by TanStack Query's `useMutation`, such as:
+ - `onSuccess`: Callback fired when the mutation succeeds.
+ - `onError`: Callback fired when the mutation fails.
+ - `onSettled`: Callback fired after the mutation finishes, regardless of success or failure.
+
+For a full list of supported options, see the TanStack Query [useMutation documentation](https://tanstack.com/query/latest/docs/react/reference/useMutation)
+
+### Returns
+
+The hook returns the following properties, provided by TanStack Query's [useMutation](https://tanstack.com/query/latest/docs/react/reference/useMutation):
+
+- `mutate({ email, password })`: Function to trigger the sign-in mutation with the provided email and password.
+
+```ts
+mutate(): void;
+```
+
+- `isPending`:
+ Boolean indicating if the mutation is in progress (alias for `isLoading`).
+
+- `isSuccess`:
+ Boolean indicating if the mutation has successfully completed.
+
+- `isError`:
+ Boolean indicating if the mutation has failed.
+
+- `error`:
+ The error object, if the mutation failed.
+
+- `data`:
+ The result of the mutation, which is typically `undefined` for sign-out operations.
+
+For a complete list of returned properties, see the official TanStack Query [useMutation](https://tanstack.com/query/latest/docs/react/reference/useMutation) documentation.
diff --git a/docs/react/auth/hooks/useUpdateCurrentUserMutation.mdx b/docs/react/auth/hooks/useUpdateCurrentUserMutation.mdx
index 1a6b3a4..2eb8de6 100644
--- a/docs/react/auth/hooks/useUpdateCurrentUserMutation.mdx
+++ b/docs/react/auth/hooks/useUpdateCurrentUserMutation.mdx
@@ -2,4 +2,89 @@
title: useUpdateCurrentUserMutation
---
-This hook is implemented, but the documentation is a work in progress, check back soon.
\ No newline at end of file
+The `useUpdateCurrentUserMutation` hook is designed to update the current authenticated user using Firebase Authentication.
+It integrates Firebase's `updateCurrentUser` method with TanStack Query’s mutation lifecycle for easy state management and error handling.
+
+
+## Features
+
+- **Firebase Authentication Integration**: Simplifies updating the current authenticated user using Firebase's `-zupdateCurrentUser` method.
+- **Built-in State Management**: Tracks the mutation lifecycle (`idle`, `loading`, `success`, `error`).
+- **Customizable Callbacks**: Supports `onSuccess`, `onError`, and other TanStack Query mutation options.
+- **Type-Safe Handling**: Ensures type safety with TanStack Query and Firebase types.
+
+## Installation
+
+Ensure you have the necessary Firebase, TanStack Query and TanStack Query Firebase packages installed:
+
+```bash
+npm install firebase @tanstack/react-query @tanstack-query-firebase/react
+```
+
+## Usage
+
+```jsx
+import { useUpdateCurrentUserMutation } from "./useUpdateCurrentUserMutation";
+
+function UpdateUserComponent() {
+ const { mutate, isPending, isSuccess, isError, error } = useUpdateCurrentUserMutation(auth);
+
+ const handleUpdateUser = (newUser) => {
+ mutate(newUser); // Trigger the user update mutation
+ };
+
+ return (
+
+ {isPending &&
Updating user...
}
+ {isSuccess &&
User updated successfully!
}
+ {isError &&
Error: {error?.message}
}
+
+
+
+ );
+}
+```
+
+## API Reference
+
+`useUpdateCurrentUserMutation(auth, options?)`
+
+### Parameters
+
+- `auth`: The Firebase `Auth` instance used to manage authentication.
+- `options` (optional):
+ An object for customizing the mutation behavior. Accepts all options supported by TanStack Query's `useMutation`, such as:
+ - `onSuccess`: Callback fired when the mutation succeeds.
+ - `onError`: Callback fired when the mutation fails.
+ - `onSettled`: Callback fired after the mutation finishes, regardless of success or failure.
+
+For a full list of supported options, see the TanStack Query [useMutation documentation](https://tanstack.com/query/latest/docs/react/reference/useMutation)
+
+### Returns
+
+The hook returns the following properties, provided by TanStack Query's [useMutation](https://tanstack.com/query/latest/docs/react/reference/useMutation):
+
+- `mutate({ email, password })`: Function to trigger the user update mutation with the provided `user` object. Pass `null` to sign out the user.
+
+```ts
+mutate(user: User | null): void;
+```
+
+- `isPending`:
+ Boolean indicating if the mutation is in progress (alias for `isLoading`).
+
+- `isSuccess`:
+ Boolean indicating if the mutation has successfully completed.
+
+- `isError`:
+ Boolean indicating if the mutation has failed.
+
+- `error`:
+ The error object, if the mutation failed.
+
+- `data`:
+ The result of the mutation, which is typically `undefined` for user updates.
+
+For a complete list of returned properties, see the official TanStack Query [useMutation](https://tanstack.com/query/latest/docs/react/reference/useMutation) documentation.
diff --git a/docs/react/auth/hooks/useVerifyPasswordResetCodeMutation.mdx b/docs/react/auth/hooks/useVerifyPasswordResetCodeMutation.mdx
index e94ba52..b5e8f94 100644
--- a/docs/react/auth/hooks/useVerifyPasswordResetCodeMutation.mdx
+++ b/docs/react/auth/hooks/useVerifyPasswordResetCodeMutation.mdx
@@ -2,4 +2,92 @@
title: useVerifyPasswordResetCodeMutation
---
-This hook is implemented, but the documentation is a work in progress, check back soon.
\ No newline at end of file
+The `useVerifyPasswordResetCodeMutation` hook is designed to verify a password reset code sent by Firebase Authentication.
+It integrates Firebase's `verifyPasswordResetCode` method with TanStack Query’s mutation lifecycle, providing state management and error handling for the password reset process.
+
+## Features
+
+- **Firebase Authentication Integration**: Simplifies verifying a password reset code using Firebase's `verifyPasswordResetCode` method.
+- **Built-in State Management**: Tracks the mutation lifecycle (`idle`, `loading`, `success`, `error`).
+- **Customizable Callbacks**: Supports `onSuccess`, `onError`, and other TanStack Query mutation options.
+- **Type-Safe Handling**: Ensures type safety with TanStack Query and Firebase types.
+
+## Installation
+
+Ensure you have the necessary Firebase, TanStack Query and TanStack Query Firebase packages installed:
+
+```bash
+npm install firebase @tanstack/react-query @tanstack-query-firebase/react
+```
+
+## Usage
+
+```jsx
+import { useVerifyPasswordResetCodeMutation } from "./useVerifyPasswordResetCodeMutation";
+
+function VerifyResetCodeComponent() {
+ const { mutate, isPending, isSuccess, isError, error, data } = useVerifyPasswordResetCodeMutation(auth);
+
+ const handleVerifyResetCode = async (code) => {
+ try {
+ await mutate(code); // Trigger the verify reset code mutation
+ } catch (error) {
+ console.error("Error verifying reset code:", error);
+ }
+ };
+
+ return (
+
+ {isLoading &&
Verifying reset code...
}
+ {isSuccess &&
Reset code verified! Email: {data}
}
+ {isError &&
Error: {error?.message}
}
+
+
+
+ );
+}
+```
+
+## API Reference
+
+`useVerifyPasswordResetCodeMutation(auth, options?)`
+
+### Parameters
+
+- `auth`: The Firebase `Auth` instance used to manage authentication.
+- `options` (optional):
+ An object for customizing the mutation behavior. Accepts all options supported by TanStack Query's `useMutation`, such as:
+ - `onSuccess`: Callback fired when the mutation succeeds.
+ - `onError`: Callback fired when the mutation fails.
+ - `onSettled`: Callback fired after the mutation finishes, regardless of success or failure.
+
+For a full list of supported options, see the TanStack Query [useMutation documentation](https://tanstack.com/query/latest/docs/react/reference/useMutation)
+
+### Returns
+
+The hook returns the following properties, provided by TanStack Query's [useMutation](https://tanstack.com/query/latest/docs/react/reference/useMutation):
+
+- `mutate(code: string)`: Function to trigger the password reset code verification mutation with the provided `code`.
+
+```ts
+mutate(code: string): Promise;
+```
+
+- `isPending`:
+ Boolean indicating if the mutation is in progress (alias for `isLoading`).
+
+- `isSuccess`:
+ Boolean indicating if the mutation has successfully completed.
+
+- `isError`:
+ Boolean indicating if the mutation has failed.
+
+- `error`:
+ The error object, if the mutation failed.
+
+- `data`:
+ The result of the mutation, which is typically the user's email after successful verification.
+
+For a complete list of returned properties, see the official TanStack Query [useMutation](https://tanstack.com/query/latest/docs/react/reference/useMutation) documentation.