You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1002 B
50 lines
1002 B
import React from 'react'; |
|
import LeftColumn from './LeftColumn'; |
|
import RightContainer from './RightContainer'; |
|
const SERVER_URL = 'http://localhost:3000/' |
|
|
|
export default class Site extends React.Component { |
|
|
|
constructor(props){ |
|
super(props); |
|
|
|
this.state = { |
|
classesData: [], |
|
componentMounted: false |
|
}; |
|
} |
|
|
|
componentDidMount() { |
|
fetch(SERVER_URL + 'api/data/classes') |
|
.then(response => response.json()) |
|
.then(data => this.setState({classesData: data})) |
|
} |
|
|
|
// <LeftColumn />} |
|
// <RightContainer /> |
|
|
|
render() { |
|
|
|
console.log(this.state) |
|
|
|
return ( |
|
<div className="mainContainer"> |
|
|
|
<div className="left"> |
|
<div className="heading">Upcoming Classes</div> |
|
{this.state.classesData.map((item, i) => |
|
<div className='course-list'> |
|
<div className='subject'>{item.subject}</div> |
|
<div className='date'>{item.date}</div> |
|
</div>)} |
|
</div> |
|
|
|
<div className="right"> |
|
<div className="heading">Posts</div> |
|
|
|
</div> |
|
|
|
</div> |
|
); |
|
} |
|
}
|
|
|