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
* display name logic is now internal (eliminates dependency)
* `try/catch` added around usage of profileFactory (incase provided `profileFactory` function throws an error)
* Fix possibility of race condition with `uniqueSet` - #207
* Fix issue using storeAs with populates - #216
* Profile docs improved for clarity
* `.eslintrc` added to tests folder (extends base`.eslintrc`)
* `PULL_REQUEST_TEMPLATE` simplified
* `ISSUE_TEMPLATE` simplified and includes link to [codesandbox](https://codesandbox.io/) instead of [codepen](http://codepen.io)
* Lint removed from tests
**Do you want to request a *feature* or report a *bug*?**
2
2
3
-
(If this is a *usage question*, please **do not post it here**—post it on [gitter](https://gitter.im/redux-firebase/Lobby) or [Stack Overflow](http://stackoverflow.com/questions/tagged/react-redux-firebase) instead. If this is not a “feature” or a “bug”, or the phrase “How do I...?” applies, then it's probably a usage question.)
3
+
(If this is a *usage question*, please **do not post it here**—post it on [gitter](https://gitter.im/redux-firebase/Lobby). If this is not a “feature” or a “bug”, or the phrase “How do I...?” applies, then it's probably a usage question.)
4
4
5
5
6
6
**What is the current behavior?**
7
7
8
8
9
9
10
-
**If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://jsfiddle.net or similar.**
10
+
**If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via [codesandbox](https://codesandbox.io/) or similar.**
11
11
12
12
13
13
@@ -18,4 +18,4 @@
18
18
**Which versions of dependencies, and which browser and OS are affected by this issue? Did this work in previous versions or setups?**
19
19
20
20
<!-- Love react-redux-firebase? Please consider supporting our collective:
After logging in, profile and auth are available in redux state:
82
+
83
+
```js
84
+
import { connect } from 'react-redux'
85
+
86
+
connect(() => ({
87
+
auth: pathToJS(firebase, 'auth'),
88
+
profile: pathToJS(firebase, 'profile')
89
+
}))(SomeComponent)
90
+
```
91
+
92
+
For more information on how best to use these methods, visit the [auth recipes](/docs/recipes/auth.md)
93
+
81
94
##### Returns
82
-
[**Promise**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) with an object containing profile, user, (also credential if using oAuth provider) in case of success or the error otherwise.
95
+
[**Promise**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) with an object (or a string, see note) containing profile, user, (also credential if using oAuth provider) in case of success or the error otherwise.
96
+
97
+
**NOTE**: For email authentication in`v1.4.*` and earlier - The user's UID (a [**String**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)) is returned instead of an object. This will change in `v1.5.0` for consistency across all auth types.
83
98
84
99
##### Examples
85
100
101
+
For complete usage examples visit the [auth recipes](/docs/recipes/auth.md)
102
+
86
103
*Email*
87
104
```js
88
-
// Call with info
105
+
// NOTE: Account is not created during login for email auth. Use createUser
Copy file name to clipboardExpand all lines: docs/queries.md
+41-1Lines changed: 41 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,11 @@
1
1
# Queries
2
2
3
-
When listening to paths, it is possible to modify the query with any of [Firebase's included query methods](https://firebase.google.com/docs/reference/js/firebase.database.Query). Below are examples using Firebase query methods as well as other methods that are included (such as 'populate').
3
+
Query listeners are attached by using the `firebaseConnect` higher order component. `firebaseConnect` accepts an array of paths for which to create queries. When listening to paths, it is possible to modify the query with any of [Firebase's included query methods](https://firebase.google.com/docs/reference/js/firebase.database.Query).
4
+
5
+
**NOTE:**
6
+
By default the results of queries are stored in redux under the path of the query. If you would like to change where the query results are stored in redux, use [`storeAs` (more below)](#storeAs).
7
+
8
+
Below are examples using Firebase query methods as well as other methods that are included (such as 'populate').
4
9
5
10
## once
6
11
To load a firebase location once instead of binding, the once option can be used:
@@ -195,6 +200,41 @@ Can be used to keep internal parsing from happening. Useful when attempting to s
195
200
])
196
201
```
197
202
203
+
204
+
## storeAs {#populate}
205
+
206
+
By default the results of queries are stored in redux under the path of the query. If you would like to change where the query results are stored in redux, use `storeAs`:
207
+
208
+
#### Examples
209
+
1. Querying the same path with different query parameters
myProjects:populatedDataToJS(firebase, 'myProjects'), // use storeAs path to gather from redux
219
+
}))
220
+
```
221
+
222
+
## ordered {#ordered}
223
+
224
+
In order to get ordered data, use `orderedToJS`
225
+
226
+
#### Examples
227
+
1. Get list of projects ordered by key
228
+
229
+
```js
230
+
@firebaseConnect(props=> [
231
+
{ path:'projects', queryParams: ['orderByKey'] }
232
+
])
233
+
@connect(({ firebase }, props) => ({
234
+
projects:orderedToJS(firebase, 'projects'),
235
+
}))
236
+
```
237
+
198
238
## Populate {#populate}
199
239
200
240
Populate allows you to replace IDs within your data with other data from Firebase. This is very useful when trying to keep your data flat. Some would call it a _join_, but it was modeled after [the mongo populate method](http://mongoosejs.com/docs/populate.html).
Copy file name to clipboardExpand all lines: docs/recipes/profile.md
+49-4Lines changed: 49 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,50 @@
1
-
### Change Profile
2
-
When signing up, you can modify how user profiles written to the database.
1
+
# Profile
2
+
3
+
Profile object is used to store data associated with a user.
4
+
5
+
## Basic
6
+
Include the `userProfile` parameter in config when setting up store middleware:
7
+
8
+
```js
9
+
constconfig= {
10
+
userProfile:'users', // where profiles are stored in database
11
+
}
12
+
reactReduxFirebase(fbConfig, config)
13
+
```
14
+
15
+
Then later wrap a component with connect:
16
+
17
+
```js
18
+
import { connect } from'react-redux'
19
+
import { pathToJS } from'react-redux-firebase'
20
+
21
+
// grab profile from redux with connect
22
+
connect((state) => {
23
+
return {
24
+
profile:pathToJS(state.firebase, 'profile') // profile passed as props.profile
25
+
}
26
+
}))(SomeComponent) // pass component to be wrapped
27
+
28
+
// or with some shorthand:
29
+
connect(({ firebase }) => ({
30
+
profile:pathToJS(state.firebase, 'profile') // profile passed as props.profile
31
+
}))(SomeComponent) // pass component to be wrapped
32
+
```
33
+
34
+
## Update Profile
35
+
36
+
**NOTE:** This feature is only available in [`v1.5.*`](http://docs.react-redux-firebase.com/history/v1.5.0/docs/recipes/profile.html)
37
+
38
+
The current users profile can be updated by using the `updateProfile` method, which is [only available in `v1.5.*`](http://docs.react-redux-firebase.com/history/v1.5.0/docs/recipes/profile.html).
39
+
40
+
## Change How Profiles Are Stored
41
+
The way user profiles are written to the database can be modified by passing the `profileFactory` parameter.
3
42
4
43
```js
5
44
// within your createStore.js or store.js file include the following config
6
45
constconfig= {
7
46
userProfile:'users', // where profiles are stored in database
8
-
profileFactory: (userData) => { // how profiles are stored in database
47
+
profileFactory: (userData, profileData) => { // how profiles are stored in database
9
48
const { user } = userData
10
49
return {
11
50
email:user.email
@@ -14,7 +53,13 @@ const config = {
14
53
}
15
54
```
16
55
17
-
### Populate Parameters
56
+
## List Online Users
57
+
58
+
**NOTE:** This feature is only available in [`v2.0.0-*`](http://docs.react-redux-firebase.com/history/v2.0.0/)
59
+
60
+
To list online users and/or track sessions, view the [presence recipe](http://docs.react-redux-firebase.com/history/v2.0.0/docs/recipes/auth.html#list-of-online-users-presence)
61
+
62
+
## Populate Parameters
18
63
If profile object contains an key or a list of keys as parameters, you can populate those parameters with the matching value from another location on firebase.
0 commit comments