reactfire 4.2.2 → 4.2.3-exp.9754f86
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.
- package/dist/auth.d.ts +5 -5
- package/dist/index.js +3 -4
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +1 -1
- package/dist/index.umd.cjs.map +1 -1
- package/package.json +1 -1
- package/src/auth.tsx +6 -13
package/package.json
CHANGED
package/src/auth.tsx
CHANGED
|
@@ -24,15 +24,8 @@ export function useUser<T = unknown>(options?: ReactFireOptions<T>): ObservableS
|
|
|
24
24
|
|
|
25
25
|
const observableId = `auth:user:${auth.name}`;
|
|
26
26
|
const observable$ = user(auth);
|
|
27
|
-
const _options: ReactFireOptions<T> = { ...options } ?? {};
|
|
28
27
|
|
|
29
|
-
|
|
30
|
-
if (auth.currentUser !== undefined) {
|
|
31
|
-
_options.initialData = auth.currentUser;
|
|
32
|
-
_options.startWithValue = auth.currentUser;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return useObservable(observableId, observable$, _options);
|
|
28
|
+
return useObservable(observableId, observable$, options);
|
|
36
29
|
}
|
|
37
30
|
|
|
38
31
|
export function useIdTokenResult(user: User, forceRefresh: boolean = false, options?: ReactFireOptions<IdTokenResult>): ObservableStatus<IdTokenResult> {
|
|
@@ -117,15 +110,15 @@ export interface SignInCheckOptionsClaimsValidator extends SignInCheckOptionsBas
|
|
|
117
110
|
*
|
|
118
111
|
* ```ts
|
|
119
112
|
* // pass in an object describing the custom claims a user must have
|
|
120
|
-
* const {status, data: signInCheckResult} =
|
|
113
|
+
* const {status, data: signInCheckResult} = useSigninCheck({requiredClaims: {admin: true}});
|
|
121
114
|
*
|
|
122
115
|
* // pass in a custom claims validator function
|
|
123
|
-
* const {status, data: signInCheckResult} =
|
|
116
|
+
* const {status, data: signInCheckResult} = useSigninCheck({validateCustomClaims: (userClaims) => {
|
|
124
117
|
* // custom validation logic...
|
|
125
118
|
* }});
|
|
126
119
|
*
|
|
127
120
|
* // You can optionally force-refresh the token
|
|
128
|
-
* const {status, data: signInCheckResult} =
|
|
121
|
+
* const {status, data: signInCheckResult} = useSigninCheck({forceRefresh: true, requiredClaims: {admin: true}});
|
|
129
122
|
* ```
|
|
130
123
|
*/
|
|
131
124
|
export function useSigninCheck(
|
|
@@ -201,7 +194,7 @@ function getClaimsObjectValidator(requiredClaims: Claims): ClaimsValidator {
|
|
|
201
194
|
}
|
|
202
195
|
|
|
203
196
|
/**
|
|
204
|
-
* @deprecated Use `
|
|
197
|
+
* @deprecated Use `useSigninCheck` instead
|
|
205
198
|
*
|
|
206
199
|
* Conditionally render children based on [custom claims](https://firebase.google.com/docs/auth/admin/custom-claims).
|
|
207
200
|
*
|
|
@@ -238,7 +231,7 @@ export function ClaimsCheck({ user, fallback, children, requiredClaims }: Claims
|
|
|
238
231
|
}
|
|
239
232
|
|
|
240
233
|
/**
|
|
241
|
-
* @deprecated Use `
|
|
234
|
+
* @deprecated Use `useSigninCheck` instead
|
|
242
235
|
*
|
|
243
236
|
* Conditionally render children based on signed-in status and [custom claims](https://firebase.google.com/docs/auth/admin/custom-claims).
|
|
244
237
|
*
|