Wings1 T1 Full-Stack Application (62638)
Wings1 T1 Full-Stack Application (62638)
Wings1 T1 Full-Stack Application (62638)
me/fresco_milestone
( @fresco_milestone )
}
})
noOfRatings: noOfRatings
}
await Course. findByIdAndUpdate(id, pa)
}
})
}
})
module.exports = usersRouter;
Type below code in “/Desktop/Projects/wings.../Reactis/src/App.js” file:
state = {
show: false,
data: [],
rating: 1,
}
componentDidMount = () => {
this. handleGetData()
}
handleGetData = () => f{
Join our channel if you haven’t joined yet https://t.me/fresco_milestone
( @fresco_milestone )
fetch(this.url + "get")
.then((res) => res.json())
-then((json) => {
this.setState({ data: json })
})
}
})
Join our channel if you haven’t joined yet https://t.me/fresco_milestone
( @fresco_milestone )
render() {
return (
<div className="home">
<header>
<h2>ABC Learning</h2>
</header>
<div className="cardContainer">
{this.state.data.map(courses => {
return (
<div className="card">
<ul>
<div className="header">
<1li>{courses.courseName}</1i>
<1i>{courses.courseDept}</1i>
<li>{courses.description}</li>
{courses.isApplied &&
<li>
{!courses.isRated &&
<li>Rate:
<select
className="rating" name="rating" onChange={this.handleRating}>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
<button className="rate"
onClick={() => this.handleAddRating(courses._id)}>Add</button>
</li>
}
{courses.isApplied &&
<button className="drop"
onClick={() => this.handleDrop(courses._id)}>Drop Course</button>
</li>
{!courses.isApplied &&
<li><button className="btn"
onClick={() => this.handleApply(courses._id)}>Apply</button></1i>
}
</div>
<div className="footer">
Join our channel if you haven’t joined yet https://t.me/fresco_milestone
( @fresco_milestone )
<li>{courses.duration} hrs .
{courses.noOfRatings} Ratings . {courses.rating}/5</li>
</div>
</ul>
</div>
)
})}
</div>
</div>
)3
}