Skip to content

Commit

Permalink
Updated comment documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
rioam2 committed May 2, 2018
1 parent e6f4a53 commit 9a04be3
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 33 deletions.
64 changes: 34 additions & 30 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,40 @@ import { connect } from 'react-redux';
import auth from './firebase-redux/actions/auth';
import database from './firebase-redux/actions/database';

const App = props => (
<div>
<h1>React-Redux-Firestore-Boilerplate</h1>
<h2>
{(props.user.isLoggedIn &&
`${props.user.data.displayName}, you are logged in`) ||
'Please log in.'}
</h2>
<button onClick={() => auth.googleAuth()} type="button">
Sign in
</button>
<button onClick={() => auth.signOut()} type="button">
Sign out
</button>
<button onClick={() => database.delete('settingsData.test')} type="button">
Update Database
</button>
</div>
);
App.propTypes = {
user: PropTypes.shape({
isLoggedIn: PropTypes.bool.isRequired,
data: PropTypes.shape({
const App = props => {
App.propTypes = {
user: PropTypes.shape({
displayName: PropTypes.string.isRequired
})
}).isRequired
}).isRequired
};
// Return JSX:
return (
<div>
<h1>React-Redux-Firestore-Boilerplate</h1>
<h2>
{(props.user && `${props.user.displayName}, you are logged in`) ||
'Please log in.'}
</h2>
<button onClick={() => auth.googleAuth()} type="button">
Sign in
</button>
<button onClick={() => auth.signOut()} type="button">
Sign out
</button>
<button
onClick={() => database.delete('settingsData.test')}
type="button"
>
Update Database
</button>
</div>
);
};

const mapStateToProps = state => ({
user: state.user,
settingsData: state.settingsData
});
export default connect(mapStateToProps, null)(App);
export default connect(
state => ({
user: state.user,
settingsData: state.settindsData
}),
null
)(App);
6 changes: 3 additions & 3 deletions src/firebase-redux/actions/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import firebaseDB from '../firebase';
const database = {
/**
* Allows you to set the value of data on the firestore database.
* This data flows back into the application through state.
* This data flows back into the application through redux state.
* @author rioam2
* @param {[type]} fieldString Field to update in 'dot-notation'.
* @param {[String]} fieldString Field to update in 'dot-notation'.
* Ex: `${StoreName}.field.subField`
* Ex: settingsData.darkMode
* @param {[type]} value The value to assign to the specified
Expand All @@ -29,7 +29,7 @@ const database = {
* Allows you to delete an entry or field from the remote firestore database
* This is done using the set method above.
* @author rioam2
* @param {[type]} fieldString Field to update in 'dot-notation'.
* @param {[String]} fieldString Field to update in 'dot-notation'.
* Ex: `${StoreName}.field.subField`
* Ex: settingsData.darkMode
*/
Expand Down
1 change: 1 addition & 0 deletions src/firebase-redux/store/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createStore } from 'redux';
import rootReducer from '../reducers';

/* Create Redux store and apply middleware */
const store = createStore(
rootReducer,
window.__REDUX_DEVTOOLS_EXTENSION__ /* eslint-disable-line */ &&
Expand Down
1 change: 1 addition & 0 deletions src/firebase-redux/stores.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/* Your store listings are defined here */
const stores = ['settingsData'];
export default stores;

0 comments on commit 9a04be3

Please sign in to comment.