import * as React from 'react';
import { connect } from 'react-redux';
import { Switch, Route, Redirect, withRouter } from 'react-router';
import LoadingIndicator from './LoadingIndicator';
import JournalList from './JournalList';
import JournalView from './JournalView';
import { routeResolver } from './App';
import { store, JournalsType, fetchJournals, StoreState, CredentialsData } from './store';
interface PropsType {
etesync: CredentialsData;
}
interface PropsTypeInner extends PropsType {
journals: JournalsType;
}
class JournalFetcher extends React.Component {
props: PropsTypeInner;
constructor(props: any) {
super(props);
}
componentDidMount() {
store.dispatch(fetchJournals(this.props.etesync));
}
render() {
if (this.props.journals.value === null) {
return ();
}
const journals = this.props.journals.value;
return (
}
/>
}
/>
}
/>
);
}
}
const mapStateToProps = (state: StoreState, props: PropsType) => {
return {
journals: state.cache.journals,
};
};
export default withRouter(connect(
mapStateToProps
)(JournalFetcher));