File tree Expand file tree Collapse file tree 6 files changed +19
-38
lines changed
src/app-pages/DashboardPage Expand file tree Collapse file tree 6 files changed +19
-38
lines changed Original file line number Diff line number Diff line change 30
30
"ol-test-utilities" : " 0.0.0"
31
31
},
32
32
"dependencies" : {
33
- "@mitodl/mitxonline-api-axios" : " ^2025.5.20 " ,
33
+ "@mitodl/mitxonline-api-axios" : " ^2025.5.23 " ,
34
34
"@tanstack/react-query" : " ^5.66.0" ,
35
35
"axios" : " ^1.6.3"
36
36
}
Original file line number Diff line number Diff line change 1
1
import { queryOptions } from "@tanstack/react-query"
2
2
import type { CourseRunEnrollment } from "@mitodl/mitxonline-api-axios/v1"
3
3
4
- import { AxiosRequestConfig } from "axios"
5
4
import { enrollmentsApi } from "../../clients"
6
-
7
- type EnrollmentsListOptions = {
8
- /**
9
- * WARNING: This is not yet implemented in the API.
10
- */
11
- orgId ?: number
12
- }
5
+ import { RawAxiosRequestConfig } from "axios"
13
6
14
7
const enrollmentKeys = {
15
8
root : [ "mitxonline" , "enrollments" ] ,
16
- coursesList : ( opts ?: EnrollmentsListOptions ) => [
9
+ enrollmentsList : ( opts : RawAxiosRequestConfig ) => [
17
10
...enrollmentKeys . root ,
18
- "courses " ,
11
+ "programEnrollments " ,
19
12
"list" ,
20
13
opts ,
21
14
] ,
22
15
}
23
16
24
17
const enrollmentQueries = {
25
- coursesList : ( opts : EnrollmentsListOptions = { } ) =>
18
+ enrollmentsList : ( opts : RawAxiosRequestConfig ) =>
26
19
queryOptions ( {
27
- queryKey : enrollmentKeys . coursesList ( opts ) ,
20
+ queryKey : enrollmentKeys . enrollmentsList ( opts ) ,
28
21
queryFn : async ( ) : Promise < CourseRunEnrollment [ ] > => {
29
- const axiosConfig = { params : opts } as AxiosRequestConfig
30
- return enrollmentsApi
31
- . enrollmentsList ( axiosConfig )
32
- . then ( ( res ) => res . data )
22
+ return enrollmentsApi . enrollmentsList ( opts ) . then ( ( res ) => res . data )
33
23
} ,
34
24
} ) ,
35
25
}
36
26
37
27
export { enrollmentQueries , enrollmentKeys }
38
- export type { EnrollmentsListOptions }
Original file line number Diff line number Diff line change @@ -5,24 +5,17 @@ import type {
5
5
} from "@mitodl/mitxonline-api-axios/v1"
6
6
import { programsApi } from "../../clients"
7
7
8
- type ProgramsListRequest = ProgramsApiProgramsListV2Request & {
9
- /**
10
- * NOT YET IMPLEMENTED
11
- */
12
- orgId ?: number
13
- }
14
-
15
8
const programsKeys = {
16
9
root : [ "mitxonline" , "programs" ] ,
17
- programsList : ( opts ?: ProgramsListRequest ) => [
10
+ programsList : ( opts ?: ProgramsApiProgramsListV2Request ) => [
18
11
...programsKeys . root ,
19
12
"list" ,
20
13
opts ,
21
14
] ,
22
15
}
23
16
24
17
const programsQueries = {
25
- programsList : ( opts : ProgramsListRequest ) =>
18
+ programsList : ( opts : ProgramsApiProgramsListV2Request ) =>
26
19
queryOptions ( {
27
20
queryKey : programsKeys . programsList ( opts ) ,
28
21
queryFn : async ( ) : Promise < PaginatedV2ProgramList > => {
@@ -32,4 +25,3 @@ const programsQueries = {
32
25
}
33
26
34
27
export { programsQueries , programsKeys }
35
- export type { ProgramsListRequest }
Original file line number Diff line number Diff line change 14
14
"@emotion/cache" : " ^11.13.1" ,
15
15
"@emotion/styled" : " ^11.11.0" ,
16
16
"@mitodl/course-search-utils" : " 3.3.2" ,
17
- "@mitodl/mitxonline-api-axios" : " ^2025.5.20 " ,
17
+ "@mitodl/mitxonline-api-axios" : " ^2025.5.23 " ,
18
18
"@mitodl/smoot-design" : " ^6.2.2" ,
19
19
"@next/bundle-analyzer" : " ^14.2.15" ,
20
20
"@remixicon/react" : " ^4.2.0" ,
Original file line number Diff line number Diff line change @@ -153,11 +153,11 @@ const OrganizationContent: React.FC<OrganizationContentProps> = ({ orgId }) => {
153
153
)
154
154
const organization = useQuery (
155
155
organizationQueries . organizationsRetrieve ( {
156
- organization_slug : b2bOrganization ?. slug ,
156
+ organization_slug : b2bOrganization ?. slug || "" ,
157
157
} ) ,
158
158
)
159
- const enrollments = useQuery ( enrollmentQueries . coursesList ( { orgId } ) )
160
- const programs = useQuery ( programsQueries . programsList ( { orgId } ) )
159
+ const enrollments = useQuery ( enrollmentQueries . enrollmentsList ( { } ) )
160
+ const programs = useQuery ( programsQueries . programsList ( { org_id : orgId } ) )
161
161
const courseGroups = useMitxonlineProgramsCourses (
162
162
programs . data ?. results ?? [ ] ,
163
163
)
You can’t perform that action at this time.
0 commit comments