Skip to content

Commit

Permalink
Add state shape documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
brettdh committed Jan 16, 2018
1 parent 89061a6 commit 2ada09a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/state/ducks/auth/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ import { handleActions } from 'redux-actions';

import * as types from './types';

/* auth reducer state shape:
{
// true iff the user is authenticated
authenticated: boolean,
}
*/

const defaultState = {
authenticated: false,
};
Expand Down
2 changes: 2 additions & 0 deletions src/state/ducks/navigation/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { RawNavigator } from '../../../navigation/AppNavigator';
const initialAction = RawNavigator.router.getActionForPathAndParams('Login');
const initialState = RawNavigator.router.getStateForAction(initialAction);

// state shape is defined by react-navigation

export default function reducer(state = initialState, action) {
const nextState = RawNavigator.router.getStateForAction(action, state);
return nextState || state;
Expand Down
13 changes: 13 additions & 0 deletions src/state/ducks/patreon/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@ import {
PATREON_ERROR,
} from './types';

/* patreon reducer state shape:
{
// true iff the user has connected Patreon
enabled: boolean,
// true iff we are waiting for a response from the Patreon API
loading: boolean,
// if not null, the error from the last Patreon API call
error: ?Error,
}
*/

const defaultState = {
enabled: false,
loading: false,
Expand Down

0 comments on commit 2ada09a

Please sign in to comment.