Work Item and Activity screens mostly complete

This commit is contained in:
John Lyon-Smith
2018-04-03 17:25:59 -07:00
parent 410d2fde4f
commit 72af9a7035
25 changed files with 512 additions and 141 deletions

View File

@@ -1,42 +1,6 @@
import React, { Fragment, Component } from 'react'
import { api } from '../API'
import { Route, Redirect } from 'react-router-native'
import { View } from 'react-native'
import autobind from 'autobind-decorator'
export class DefaultRoute extends Component {
@autobind
updateComponent() {
this.forceUpdate()
}
componentDidMount() {
api.addListener('login', this.updateComponent)
}
componentWillUnmount() {
api.removeListener('login', this.updateComponent)
}
render() {
const user = api.loggedInUser
let path = null
if (user) {
if (!user.pending) {
path = '/home'
}
} else {
path = '/login'
}
const { location } = this.props
// Render a redirect or nothing until we finished logging on
return (
<Route path='/' render={() => (
path ? <Redirect to={path} /> : null
)} />
)
}
export const DefaultRoute = () => {
return <Route render={() => (<Redirect to={'/home'} />)} />
}