Commit e46e5b81 authored by Zac Wood's avatar Zac Wood
Browse files

CourseSectionCard no longer renders static data

parent cdadfe65
...@@ -7,11 +7,11 @@ export interface SearchAction { ...@@ -7,11 +7,11 @@ export interface SearchAction {
} }
export const searchCourseSections = (crn: string) => async (dispatch: any) => { export const searchCourseSections = (crn: string) => async (dispatch: any) => {
const response = await fetch(`http://localhost:3000/api/search?crn=${crn}`); const response = await fetch(`http://localhost:3000/api/course_sections?crn=${crn}`);
const object = await response.json(); const objects = await response.json();
const results: CourseSection[] = [ const results: CourseSection[] = objects.map(
{ (object: any): CourseSection => ({
id: object.id, id: object.id,
name: object.name, name: object.name,
title: object.title, title: object.title,
...@@ -21,8 +21,8 @@ export const searchCourseSections = (crn: string) => async (dispatch: any) => { ...@@ -21,8 +21,8 @@ export const searchCourseSections = (crn: string) => async (dispatch: any) => {
days: object.days, days: object.days,
startTime: object.start_time, startTime: object.start_time,
endTime: object.end_time, endTime: object.end_time,
}, })
]; );
dispatch({ dispatch({
type: SET_SEARCH_RESULTS, type: SET_SEARCH_RESULTS,
......
...@@ -20,19 +20,20 @@ const CourseSectionCard = ({ ...@@ -20,19 +20,20 @@ const CourseSectionCard = ({
<Card> <Card>
<CardBody> <CardBody>
<CardTitle className="mb-4"> <CardTitle className="mb-4">
<i className="fas fa-hashtag" /> 78212 <i className="fas fa-hashtag" /> {courseSection.crn}
</CardTitle> </CardTitle>
<Row> <Row>
<Col md="6"> <Col md="6">
<div className="mb-4"> <div className="mb-4">
<h4>Senior Adv Design Project I</h4> <h4>{courseSection.title}</h4>
<p>CYSE 492 - 001</p> <p>{courseSection.name}</p>
</div> </div>
<i className="fas fa-chalkboard-teacher fa-fw" /> Gino J Manzo <i className="fas fa-chalkboard-teacher fa-fw" /> {courseSection.instructor}
<br /> <br />
<i className="fas fa-clock fa-fw" /> Thursdays, 4:30 pm - 6:20 pm <i className="fas fa-clock fa-fw" /> {courseSection.days}, {courseSection.startTime} -{' '}
{courseSection.endTime}
<br /> <br />
<i className="fas fa-school fa-fw" /> James Buchanan Hall D023 <i className="fas fa-school fa-fw" /> {courseSection.location}
</Col> </Col>
<Col md="6"> <Col md="6">
<Button <Button
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment