You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* feat(hooks): hook rework to match existing HOC - prescottprue#734 - @illuminist
* fix(hooks): remove create functions (`createUseFirestore`, `createWithFirestore`, `createUseFirebase`, `createWithFirebase`) since store selection is not necessary
* feat(auth): add custom claims - prescottprue#741 - @joerex
* fix(types): changed extended firebase instance to function - prescottprue#743 - @rscotten
* fix(types): switch `typeof Firebase` to `any` (prevents issue with passing some version of Firebase JS SDK)
* fix(examples): update material and typescript examples
to provided firebase paths using React's useEffect hook.
33
-
**Note** Only single path is allowed per one hook
34
33
35
34
**Parameters**
36
35
37
-
-`queriesConfig`**([Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)\|[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String))** Object or string for path to sync
38
-
from Firebase or null if hook doesn't need to sync.
39
-
Can also be a function that returns an object or a path string.
36
+
-`queriesConfigs`**([Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)\|[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)\|[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)\|[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array))** Object, string, or
37
+
array contains object or string for path to sync from Firebase or null if
38
+
hook doesn't need to sync. Can also be a function that returns an object,
39
+
a path string, or array of an object or a path string.
40
40
41
41
**Examples**
42
42
@@ -50,11 +50,11 @@ import { firebaseUseConnect } from 'react-redux-firebase'
50
50
constenhance=compose(
51
51
connect((state) => ({
52
52
todos:state.firebase.ordered.todos
53
-
})
53
+
}))
54
54
)
55
55
56
56
// use enhnace to pass todos list as props.todos
57
-
constTodos=enhance(({ todos }))=> {
57
+
functionTodos({ todos })) {
58
58
useFirebaseConnect('todos') // sync /todos from firebase into redux
// create useFirestore that uses another redux store
29
-
constuseFirestore=createUseFirestore()
30
-
31
-
// use the useFirestore to wrap a component
32
-
exportdefaultuseFirestore(SomeComponent)
33
-
```
34
-
35
-
Returns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** Higher Order Component which accepts an array of
36
-
watchers config and wraps a React Component
37
-
38
7
## useFirestore
39
8
40
-
**Extends React.Component**
41
-
42
9
React hook that return firestore object.
43
10
Firestore instance is gathered from `store.firestore`, which is attached
44
11
to store by the store enhancer (`reduxFirestore`) during setup of
@@ -54,12 +21,15 @@ import { useFirestore } from 'react-redux-firebase'
@@ -34,12 +34,12 @@ React hook that automatically listens/unListens
34
34
to provided Cloud Firestore paths. Make sure you have required/imported
35
35
Cloud Firestore, including it's reducer, before attempting to use.
36
36
**Note** Populate is not yet supported.
37
-
**Note2** Only single path is allowed per one hook
38
37
39
38
**Parameters**
40
39
41
-
-`queriesConfig`**([Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)\|[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String))** An object or string for paths to sync
42
-
from firestore. Can also be a function that returns the object or string.
40
+
-`queriesConfig`**([Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)\|[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)\|[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\|[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function))** An object, string,
41
+
or array of object or string for paths to sync from firestore. Can also be
42
+
a function that returns the object, string, or array of object or string.
Copy file name to clipboardExpand all lines: docs/auth.md
+8
Original file line number
Diff line number
Diff line change
@@ -49,6 +49,14 @@ class SomeComponent extends Component {
49
49
exportdefaultfirebaseConnect()(SomeComponent) // or withFirebase(SomeComponent)
50
50
```
51
51
52
+
#### Custom Claims
53
+
54
+
Firebase has a secure way of identifying and making claims about users with [custom claims](https://firebase.google.com/docs/auth/admin/custom-claims). This is a good way to provide roles for users.
55
+
56
+
If `enableClaims` config option is used along with `userProfile` you will find custom claims in `state.firebase.profile.token.claims`.
57
+
58
+
**Note**: If a claim is added to a user who is already logged in those changes will not necessarily be propagated to the client. In order to assure the change is observed, use a `refreshToken` property in your `userProfile` collection and update it's value after the custom claim has been added. Because `react-redux-firebase` watches for profile changes, the custom claim will be fetched along with the `refreshToken` update.
59
+
52
60
For examples of how to use this API, checkout the [auth recipes section](/docs/recipes/auth.html).
0 commit comments