feat(courses): Add Categories listing

This commit is contained in:
Khaled Garbaya
2017-09-26 15:24:12 +02:00
committed by Benedikt Rötsch
parent 0c66b6678c
commit 200a8ae2f1
4 changed files with 30 additions and 6 deletions

View File

@@ -12,6 +12,7 @@ exports.getCourses = () => {
// to get all the courses we simply request from Contentful all the entries
// with the content_type `course`
return client.getEntries({content_type: 'course'})
.then((response) => response.items)
}
exports.getLandingPage = () => {
@@ -33,10 +34,15 @@ exports.getLessons = (courseId) => {
}
exports.getCategories = () => {
// TODO
return client.getEntries({content_type: 'category'})
.then((response) => response.items)
}
exports.getCoursesByCategory = (category) => {
// TODO
return client.getEntries({
content_type: 'course',
'fields.category.sys.contentType.sys.id': category
})
.then((response) => response.items)
}