-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change Catalog to use v2 API endpoint for courses (#1987)
* swap catalog to use v2 * tests, lint, fmt
- Loading branch information
1 parent
9b85ae4
commit 0256cc4
Showing
3 changed files
with
26 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { pathOr } from "ramda" | ||
|
||
import { nextState } from "./util" | ||
|
||
export const coursesSelector = pathOr(null, ["entities", "courses", "results"]) | ||
|
||
export const coursesNextPageSelector = pathOr(null, [ | ||
"entities", | ||
"courses", | ||
"next" | ||
]) | ||
|
||
export const coursesQueryKey = "courses" | ||
|
||
export const coursesQuery = page => ({ | ||
queryKey: coursesQueryKey, | ||
url: `/api/v2/courses/?page=${page}&live=true&page__live=true&courserun_is_enrollable=true`, | ||
transform: json => ({ | ||
courses: json | ||
}), | ||
update: { | ||
courses: nextState | ||
} | ||
}) |