Created
August 23, 2016 17:07
-
-
Save binzailani3136/799edc5a6911abf2b1351c2535d733a0 to your computer and use it in GitHub Desktop.
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
import * as firebase from 'firebase'; | |
const firebaseConfig = { | |
apiKey: "AIzaSyAfHOFdjPwByt_S7RSPcyF5OPzwp_????", | |
authDomain: "??????-44ce2.firebaseapp.com", | |
databaseURL: "https://??????-44ce2.firebaseio.com", | |
storageBucket: "", | |
}; | |
const app = firebase.initializeApp(firebaseConfig); |
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
var user = firebase.auth().currentUser; | |
if (user != null) { | |
this.itemsRef = this.getRef().child('Stores/'+user.uid+'/'); | |
}else { | |
alert('you have to login again!'); | |
}; | |
const connectedRef = firebase.database().ref('.info/connected'); | |
connectedRef.on('value', snap => { | |
if (snap.val() === true) { | |
this.listenForItems(this.itemsRef); | |
} else { | |
this.offlineForItems(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment