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 { createStore, applyMiddleware } from 'redux'; | |
import { persistStore, persistReducer } from 'redux-persist'; | |
import storage from 'redux-persist/lib/storage'; | |
import ReduxThunk from 'redux-thunk'; | |
import logger from 'redux-logger'; | |
import { composeWithDevTools } from 'redux-devtools-extension/developmentOnly'; | |
import rootReducer from '../reducers'; | |
const middlewares = [ReduxThunk]; |
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
onLogin = async () => { | |
try { | |
const response = await firebase.auth().signInWithEmailAndPassword(this.state.emailValue, this.state.passwordValue); | |
console.log(response); | |
this.setState({ | |
loggingIn: false, | |
emailValue: '', | |
passwordValue: '', | |
hasError: false, | |
error: '', |
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
constructor() { | |
super(); | |
this.ref = firebase.firestore().collection('posts'); | |
this.firestoreUnsubscriber = null; | |
this.authUnsubscriber = null; | |
this.state = { | |
posts: [], | |
loading: true, | |
loggingIn: false, | |
user: null, |
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
addRandomPost = () => { | |
this.ref.add({ | |
title: 'Added post by random button', | |
likes: Math.floor((Math.random() * 10) + 1), | |
uri: `https://picsum.photos/200/300?image=${Math.floor((Math.random() * 100) + 1)}`, | |
}); | |
} |
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
constructor() { | |
super(); | |
this.ref = firebase.firestore().collection('posts'); | |
this.unsubscribe = null; | |
this.state = { | |
posts: [], | |
loading: true, | |
}; | |
} |
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
atom-sync |
NewerOlder