Created
March 7, 2018 09:10
-
-
Save SastraNababan/451ded97012198ad6c0139d72bbd2a75 to your computer and use it in GitHub Desktop.
firebase config
This file contains 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
import firebase from 'react-native-firebase' | |
const config = { | |
apiKey: "AIzaSyBiXJTuUD5Ya9PUM81l5qQ83bOZIAlvIGE", | |
authDomain: "react-native-73f21.firebaseapp.com", | |
databaseURL: "https://react-native-73f21.firebaseio.com", | |
projectId: "react-native-73f21", | |
storageBucket: "react-native-73f21.appspot.com", | |
messagingSenderId: "150783570753" | |
}; | |
export const rootRef = firebase.app().database().ref() | |
export const itemsRef = rootRef.child('items'); | |
export function syncFirebase(store) { | |
itemsRef.on('child_added', (snapshot) => { | |
console.log(snapshot.val()) | |
// store.dispatch(addItemSuccess(snapshot.val())) | |
}) | |
itemsRef.on('child_removed', (snapshot) => { | |
console.log(snapshot.val()) | |
// store.dispatch(removeItemSuccess(snapshot.val().id)) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment