react-query-firebase 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,3 +7,5 @@ export * from "./useAuthStateReady";
7
7
  export * from "./useSignInWitRedirectMutation";
8
8
  export * from "./useUpdateProfileMutation";
9
9
  export * from "./useSignOutMutation";
10
+ export * from "./useReauthenticateWitCredentialMutation";
11
+ export * from "./useReauthenticateWitRedirectMutation";
@@ -7,3 +7,5 @@ export * from "./useAuthStateReady";
7
7
  export * from "./useSignInWitRedirectMutation";
8
8
  export * from "./useUpdateProfileMutation";
9
9
  export * from "./useSignOutMutation";
10
+ export * from "./useReauthenticateWitCredentialMutation";
11
+ export * from "./useReauthenticateWitRedirectMutation";
@@ -0,0 +1,8 @@
1
+ import { UseMutationOptions } from "@tanstack/react-query";
2
+ import { User, AuthCredential, UserCredential } from "firebase/auth";
3
+ import { FirebaseError } from "firebase/app";
4
+ export type UseReauthenticateWitCredentialMutationVariables = {
5
+ credential: AuthCredential;
6
+ user: User;
7
+ };
8
+ export declare const useReauthenticateWitCredentialMutation: <TContext = unknown>(options?: Omit<UseMutationOptions<UserCredential, FirebaseError, UseReauthenticateWitCredentialMutationVariables, TContext>, "mutationKey" | "mutationFn">) => import("@tanstack/react-query").UseMutationResult<UserCredential, FirebaseError, UseReauthenticateWitCredentialMutationVariables, TContext>;
@@ -0,0 +1,10 @@
1
+ import { useMutation } from "@tanstack/react-query";
2
+ import { reauthenticateWithCredential } from "firebase/auth";
3
+ import { REAUTHENTICATE_WITH_CREDENTIAL_MUTATION_KEY } from "./mutation-keys";
4
+ export const useReauthenticateWitCredentialMutation = (options = {}) => {
5
+ return useMutation({
6
+ ...options,
7
+ mutationFn: async ({ credential, user }) => reauthenticateWithCredential(user, credential),
8
+ mutationKey: REAUTHENTICATE_WITH_CREDENTIAL_MUTATION_KEY
9
+ });
10
+ };
@@ -0,0 +1,9 @@
1
+ import { UseMutationOptions } from "@tanstack/react-query";
2
+ import { AuthProvider, PopupRedirectResolver, User } from "firebase/auth";
3
+ import { FirebaseError } from "firebase/app";
4
+ export type UseReauthenticateWitRedirectMutationVariables = {
5
+ authProvider: AuthProvider;
6
+ popupRedirectResolver?: PopupRedirectResolver;
7
+ user: User;
8
+ };
9
+ export declare const useReauthenticateWitRedirectMutation: <TContext = unknown>(options?: Omit<UseMutationOptions<void, FirebaseError, UseReauthenticateWitRedirectMutationVariables, TContext>, "mutationKey" | "mutationFn">) => import("@tanstack/react-query").UseMutationResult<void, FirebaseError, UseReauthenticateWitRedirectMutationVariables, TContext>;
@@ -0,0 +1,10 @@
1
+ import { useMutation } from "@tanstack/react-query";
2
+ import { reauthenticateWithRedirect } from "firebase/auth";
3
+ import { REAUTHENTICATE_WITH_REDIRECT_MUTATION_KEY } from "./mutation-keys";
4
+ export const useReauthenticateWitRedirectMutation = (options = {}) => {
5
+ return useMutation({
6
+ ...options,
7
+ mutationFn: async ({ authProvider, user, popupRedirectResolver }) => reauthenticateWithRedirect(user, authProvider, popupRedirectResolver),
8
+ mutationKey: REAUTHENTICATE_WITH_REDIRECT_MUTATION_KEY
9
+ });
10
+ };
package/package.json CHANGED
@@ -53,5 +53,5 @@
53
53
  "lint:staged": "lint-staged",
54
54
  "prepare": "husky"
55
55
  },
56
- "version": "1.0.0"
56
+ "version": "1.0.2"
57
57
  }
package/src/auth/index.ts CHANGED
@@ -7,3 +7,5 @@ export * from "./useAuthStateReady";
7
7
  export * from "./useSignInWitRedirectMutation";
8
8
  export * from "./useUpdateProfileMutation";
9
9
  export * from "./useSignOutMutation";
10
+ export * from "./useReauthenticateWitCredentialMutation";
11
+ export * from "./useReauthenticateWitRedirectMutation";