forked from prescottprue/react-redux-firebase
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHome.js
More file actions
28 lines (23 loc) · 600 Bytes
/
Home.js
File metadata and controls
28 lines (23 loc) · 600 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import React from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
import { isLoaded, isEmpty } from 'react-redux-firebase'
import Todos from './Todos'
import LoginView from './LoginView'
function Home({ auth }) {
// handle initial loading of auth
if (!isLoaded(auth)) {
return <div>Loading...</div>
}
// User is not logged in, show login view
if (isEmpty(auth)) {
return <LoginView />
}
return <Todos uid={auth.uid} />
}
Home.propTypes = {
auth: PropTypes.object
}
export default connect(state => ({
auth: state.firebase.auth
}))(Home)