-
Notifications
You must be signed in to change notification settings - Fork 0
Feature: Firebase setup #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Luffi2539
wants to merge
10
commits into
master
Choose a base branch
from
firebase-setup
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
e973415
init firebase config and add simple form for db tests
edvardskazlouski 803b8b1
add initial setup for adding info to firebase db
edvardskazlouski e160024
add redux-saga-firebase library and setup
edvardskazlouski abb72d2
add test functionality for document adding
edvardskazlouski 64b6db8
add empty input check
edvardskazlouski ca2abef
add firestore reducer
edvardskazlouski 01fd911
conect firebase with redux
edvardskazlouski 22c49db
merge conflicts
edvardskazlouski 6ec2660
move firebase creds to env
edvardskazlouski f9a5cb7
fix sending data
Luffi2539 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,12 @@ | ||
| NODE_PATH='src/' | ||
| REACT_APP_SERVER_PATH=http://localhost:3000 | ||
|
|
||
| #Firebase creds | ||
| REACT_APP_FIREBASE_CONFIG_API_KEY=AIzaSyBPUuIONtxcQ3efdGpMGbJVEn6fUG_1E5g | ||
| REACT_APP_FIREBASE_CONFIG_AUTH_DOMAIN=my-first-project-8d8d9.firebaseapp.com | ||
| REACT_APP_FIREBASE_CONFIG_DB_URL=https://my-first-project-8d8d9.firebaseio.com | ||
| REACT_APP_FIREBASE_CONFIG_PROJECT_ID=my-first-project-8d8d9 | ||
| REACT_APP_FIREBASE_CONFIG_STORAGE_BUCKET=my-first-project-8d8d9.appspot.com | ||
| REACT_APP_FIREBASE_CONFIG_MSG_SENDER_ID=801023450889 | ||
|
|
||
| S3_BUCKET_NAME= |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import firebase from 'firebase/app'; | ||
| import '@firebase/firestore'; | ||
| import '@firebase/auth'; | ||
|
|
||
| export const config = { | ||
| apiKey: process.env.REACT_APP_FIREBASE_CONFIG_API_KEY, | ||
| authDomain: process.env.REACT_APP_FIREBASE_CONFIG_AUTH_DOMAIN, | ||
| databaseURL: process.env.REACT_APP_FIREBASE_CONFIG_DB_URL, | ||
| projectId: process.env.REACT_APP_FIREBASE_CONFIG_PROJECT_ID, | ||
| storageBucket: process.env.REACT_APP_FIREBASE_CONFIG_STORAGE_BUCKET, | ||
| messagingSenderId: process.env.REACT_APP_FIREBASE_CONFIG_MSG_SENDER_ID | ||
| }; | ||
|
|
||
| firebase.initializeApp(config); | ||
| firebase.firestore(); | ||
|
|
||
| export default firebase; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| import { createAction } from 'redux-actions'; | ||
| import ActionsTypes from './actionsTypes'; | ||
|
|
||
| export const sendData = createAction(ActionsTypes.SEND_DATA); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import namespace from 'helpers/namespace'; | ||
|
|
||
| export default namespace({ | ||
| SEND_DATA: null | ||
| }, 'FIREBASE'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import * as AllActionsCreators from './actionsCreators'; | ||
| import saga from './saga'; | ||
|
|
||
| const ActionsCreators = { | ||
| sendData: AllActionsCreators.sendData, | ||
| }; | ||
|
|
||
| export { | ||
| ActionsCreators, | ||
| saga, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import firebase from 'config/fbConfig'; | ||
| import '@firebase/firestore'; | ||
| import '@firebase/auth'; | ||
| import ReduxSagaFirebase from 'redux-saga-firebase'; | ||
|
|
||
| const rsf = new ReduxSagaFirebase(firebase); | ||
|
|
||
| export default rsf; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import { takeEvery, call } from 'redux-saga/effects'; | ||
| import ActionsTypes from './actionsTypes'; | ||
| import rsf from './rsf'; | ||
|
|
||
|
|
||
| export function* addFirebaseDataSaga({ payload }) { | ||
| if (payload.name && payload.age) { | ||
| yield call(rsf.firestore.addDocument, 'user', payload); | ||
| } | ||
| } | ||
|
|
||
| export default function* firebaseSaga() { | ||
| yield takeEvery(ActionsTypes.SEND_DATA, addFirebaseDataSaga); | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,6 @@ | ||
| import { connect } from 'react-redux'; | ||
| import { firestoreConnect } from 'react-redux-firebase'; | ||
| import { compose } from 'redux'; | ||
|
|
||
| // actions creators | ||
| import { | ||
|
|
@@ -15,6 +17,10 @@ import { | |
| import { | ||
| cancelRequest | ||
| } from 'actionCreators/views/test'; | ||
|
|
||
| import { | ||
| addFirebaseData | ||
| } from 'actionCreators/views/test'; | ||
| // view | ||
| import Test from './Test'; | ||
|
|
||
|
|
@@ -25,10 +31,17 @@ const mapDispatchToProps = { | |
| submitValue: values => submitValue(values.testField), | ||
| openTestModal, | ||
| initiateRequest, | ||
| cancelRequest | ||
| cancelRequest, | ||
| addFirebaseData | ||
|
|
||
| }; | ||
|
|
||
| export default connect( | ||
| testSelector, | ||
| mapDispatchToProps, | ||
| export default compose ( | ||
| connect( | ||
| testSelector, | ||
| mapDispatchToProps, | ||
| ), | ||
| firestoreConnect([ | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how to get firestore collection/element into selector/ |
||
| {collection: 'user'} | ||
| ]) | ||
| )(Test); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,8 @@ | ||
| import { combineReducers } from 'redux-immutable'; | ||
| import { reducer as formReducer } from 'redux-form'; | ||
| import { connectRouter } from 'connected-react-router/immutable'; | ||
| import { firestoreReducer } from 'redux-firestore'; | ||
| import { firebaseReducer } from 'react-redux-firebase'; | ||
|
|
||
| // generic | ||
| import modals from './modals'; | ||
|
|
@@ -18,7 +20,8 @@ import test from './views/test'; | |
|
|
||
| export default (history) => combineReducers({ | ||
| form: formReducer, | ||
|
|
||
| firebase: firebaseReducer, | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. check immutable |
||
| firestore: firestoreReducer, | ||
| // generic | ||
| router: connectRouter(history), | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
each action should dispatch start, end or error