gifFirebaseRef.on('value', snapshot => { const gifURL = snapshot.val() || ''; // got the url, stop listening for changes if (gifURL) { gifFirebaseRef.off(); this.goOffline(); setMessage(''); this.setState( { gifFirebaseRef, gifURL, loading: false, processing: false }, () => { this.updateBackgroundColor(); this.updateAddThis(); }, ); } else if (!processing) { this.goOffline(); setMessage(''); // user opened by url // we saw if exists. it didnt. so lets redirect it to the main page push(`/#${subject}`); } });
const fetchEmployees = () => { const {currentUser} = firebase.auth(); return (dispatch) => { firebase.database().ref(`/users/${currentUser.uid}/employees`) .on('value', (snapshot) => { dispatch({type: FETCH_EMPLOYEE_SUCCESS, payload: snapshot.val()}) }); //TODO catch error } }
// on value change, update checkin status state checkinRef.on('value', snapshot => { if (!snapshot.hasChild('endTime')) { update.setActiveRoom(snapshot, response.data.checkinData, this.props, checkinID); } else checkinRef.off('value'); });
componentDidMount() { this.firebaseDateRef.on('value', snapshot => { this.props.userActions.loadUserInfo(this.props.match.params.uid, snapshot.val()); this.setState({ loading: false }); }) }
db.ref('.info/connected').on('value',function(snap){ if(snap.val() === true) console.log('Connected to firebase'); else console.log('Disconnected from firebase'); });
connectedRef.on("value", function(snap) { if (snap.val() === true) { console.log('connected bitch'); } else { console.log('fuck shit disconnected'); } });
const fetchToDos = () => async dispatch => { todosRef.on("value", snapshot => { dispatch({ type: FETCH_TODOS, payload: snapshot.val() }); }); }
gifFirebaseRef.on('value', snapshot => { const gifURL = snapshot.val() || ''; // got the url, stop listening for changes if (gifURL) { gifFirebaseRef.off(); this.goOffline(); setMessage(''); this.setState( { gifFirebaseRef, gifURL, loading: false, processing: false }, () => { this.updateBackgroundColor(); this.updateAddThis(); }, ); } else if (!processing) { this.goOffline(); setMessage(''); // user opened by url // we saw if exists. it didnt. so lets redirect it to the main page push(`/#${subject}`); } });
// on value change, update checkin status state checkinRef.on('value', snapshot => { if (!snapshot.hasChild('endTime')) { update.setActiveRoom(snapshot, response.data.checkinData, this.props, checkinID); } else checkinRef.off('value'); });