Skip to content
Prev Previous commit
Next Next commit
Presence added
* Auth actions simplified (no more default export, removed some
dispatch functions)
* presence and sessions default config added
* Docs updated
  • Loading branch information
prescottprue committed Jul 3, 2017
commit a9dc8f93b5e2f9971d41a814ad978b6f592b3c4e
21 changes: 6 additions & 15 deletions docs/api/compose.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,37 +54,28 @@ _Setup_
```javascript
import { createStore, compose } from 'redux'
import { reactReduxFirebase } from 'react-redux-firebase'
import * as firebase from 'firebase'

// React Redux Firebase Config
const config = {
userProfile: 'users', // saves user profiles to '/users' on Firebase
// here is where you place other config options
}

// initialize script from Firebase page
const fbConfg = {} // firebase config object
firebase.initializeApp(fbConfig)

// Add react-redux-firebase to compose
// Note: In full projects this will often be within createStore.js or store.js
const createStoreWithFirebase = compose(
reactReduxFirebase(fbConfig, config),
reactReduxFirebase(firebase, config),
)(createStore)

// Use Function later to create store
const store = createStoreWithFirebase(rootReducer, initialState)
```

_Custom Auth Parameters_

```javascript
// Follow Setup example with the following config:
const config = {
customAuthParameters: {
google: {
// prompts user to select account on every google login
prompt: 'select_account'
}
}
}
```

Returns **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** That accepts a component a returns a wrapped version of component

# getFirebase
Expand Down
5 changes: 5 additions & 0 deletions docs/api/constants.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ Default configuration options

- `userProfile` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** `null` Location on Firebase where user
profiles are stored. Often set to `'users'`.
- `presence` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** `null` Location on Firebase where of currently
online users is stored. Often set to `'presence'` or `'onlineUsers'`.
- `sessions` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** `sessions` Location on Firebase where user
sessions are stored (only if presense is set). Often set to `'presence'` or
`'onlineUsers'`.
- `enableLogging` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** `false` Whether or not firebase
database logging is enabled.
- `updateProfileOnLogin` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** `true` Whether or not to update
Expand Down
124 changes: 100 additions & 24 deletions docs/api/reducer.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,104 @@
# getSlashStrPath

Trim leading slash from path for use with state

**Parameters**

- `path` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Path seperated with slashes

Returns **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Path seperated with dots

# getDotStrPath

Convert path with slashes to dot seperated path (for use with lodash get/set)

**Parameters**

- `path` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Path seperated with slashes

Returns **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Path seperated with dots

# requestingReducer

Reducer for requesting state. Changed by `START` and `SET` actions.
Reducer for requesting state.Changed by `START`, `NO_VALUE`, and `SET` actions.

**Parameters**

- `state` **\[[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)](default {})** Current requesting redux state
- `action` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object containing the action that was dispatched
- `state` **\[[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)]** Current requesting redux state (optional, default `{}`)
- `action` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object containing the action that was dispatched
- `action.type` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Type of action that was dispatched
- `action.path` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Path of action that was dispatched
- `$1` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
- `$1.type`
- `$1.path`

Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Profile state after reduction

# dataReducer
# requestedReducer

Reducer for data state. Changed by `LOGIN`, `LOGOUT`, and `LOGIN_ERROR`
actions.
Reducer for requested state. Changed by `START`, `NO_VALUE`, and `SET` actions.

**Parameters**

- `state` **\[[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)](default {})** Current data redux state
- `action` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object containing the action that was dispatched
- `state` **\[[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)]** Current requested redux state (optional, default `{}`)
- `action` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object containing the action that was dispatched
- `action.type` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Type of action that was dispatched
- `action.path` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Path of action that was dispatched
- `$1` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
- `$1.type`
- `$1.path`

Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Profile state after reduction

# timestampsReducer

Reducer for timestamps state. Changed by `START`, `NO_VALUE`, and `SET` actions.

**Parameters**

- `state` **\[[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)]** Current timestamps redux state (optional, default `{}`)
- `action` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object containing the action that was dispatched
- `action.type` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Type of action that was dispatched
- `action.path` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Path of action that was dispatched
- `$1` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
- `$1.type`
- `$1.path`

Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Profile state after reduction

# dataReducer

Reducer for data state. Changed by `SET`, `SET_ORDERED`,`NO_VALUE`, and
`LOGOUT` actions.

**Parameters**

- `state` **\[[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)]** Current data redux state (optional, default `{}`)
- `action` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object containing the action that was dispatched
- `action.type` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Type of action that was dispatched
- `action.path` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Path of action that was dispatched
- `$1` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
- `$1.type`
- `$1.path`
- `$1.data`
- `$1.ordered`
- `$1.preserve`

Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Data state after reduction

# authReducer

Reducer for auth state. Changed by `LOGIN`, `LOGOUT`, and `LOGIN_ERROR`
actions.
Reducer for auth state. Changed by `LOGIN`, `LOGOUT`, and `LOGIN_ERROR` actions.

**Parameters**

- `state` **\[[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)](default {})** Current auth redux state
- `action` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object containing the action that was dispatched
- `state` **\[[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)]** Current auth redux state (optional, default `{isLoaded:false}`)
- `action` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object containing the action that was dispatched
- `action.type` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Type of action that was dispatched
- `$1` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
- `$1.type`
- `$1.auth`
- `$1.preserve`

Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Profile state after reduction

Expand All @@ -40,32 +109,38 @@ Reducer for profile state. Changed by `SET_PROFILE`, `LOGOUT`, and

**Parameters**

- `state` **\[[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)](default null)** Current profile redux state
- `state` **\[[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)]** Current profile redux state (optional, default `{isLoaded:false}`)
- `action` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object containing the action that was dispatched
- `action.type` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Type of action that was dispatched
- `$1` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
- `$1.type`
- `$1.profile`

Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Profile state after reduction

# isInitializingReducer
# errorsReducer

Reducer for isInitializing state. Changed by `AUTHENTICATION_INIT_STARTED`
and `AUTHENTICATION_INIT_FINISHED` actions.
Reducer for errors state. Changed by `UNAUTHORIZED_ERROR`
and `LOGOUT` actions.

**Parameters**

- `state` **\[[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)](default false)** Current isInitializing redux state
- `action` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object containing the action that was dispatched
- `state` **\[[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)]** Current authError redux state (optional, default `[]`)
- `action` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object containing the action that was dispatched
- `action.type` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Type of action that was dispatched

Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Profile state after reduction

# errorsReducer
# isInitializingReducer

Reducer for errors state. Changed by `UNAUTHORIZED_ERROR`
and `LOGOUT` actions.
Reducer for isInitializing state. Changed by `AUTHENTICATION_INIT_STARTED`
and `AUTHENTICATION_INIT_FINISHED` actions.

**Parameters**

- `state` **\[[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)](default \[])** Current authError redux state
- `state` **\[[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)]** Current isInitializing redux state (optional, default `false`)
- `action` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object containing the action that was dispatched
- `action.type` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Type of action that was dispatched

Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Profile state after reduction

Expand All @@ -81,6 +156,7 @@ changes.
- `state` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Current Redux State
- `action` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Action which will modify state
- `action.type` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Type of Action being called
- `action.data` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Type of Action which will modify state
- `action.path` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Path of action that was dispatched
- `action.data` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Data associated with action

Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** State
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Firebase redux state
Loading