blob: d82a8db0e1d7aa4f9bbef41d055393302355ad96 (
plain)
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
29
30
31
32
33
34
35
36
37
38
39
|
import React, { Component } from 'react'
import { NavLink } from 'react-router-dom'
import { bindActionCreators } from 'redux'
import { connect } from 'react-redux'
import * as actions from '../actions'
class Header extends Component {
componentDidMount() {
this.props.actions.getInstitutions()
this.props.actions.getPapers()
}
render() {
console.log(this.props)
let { papers } = this.props.api.papers
papers = papers || {}
const paperOptions = Object.keys(papers).map(key => (
<option key={key} value={key}>{papers[key][1]}</option>
))
console.log(papers)
return (
<header>
<select>
{paperOptions}
</select>
</header>
)
}
}
const mapStateToProps = state => ({
api: state.api
})
const mapDispatchToProps = dispatch => ({
actions: bindActionCreators({ ...actions }, dispatch),
})
export default connect(mapStateToProps, mapDispatchToProps)(Header)
|