@@ -19,17 +19,17 @@ const getProject = (projectId) => (
19
19
M2m . getMachineToken ( config . AUTH0_CLIENT_ID , config . AUTH0_CLIENT_SECRET )
20
20
. then ( ( token ) => (
21
21
request
22
- . get ( `${ config . TC_API_V4_BASE_URL } /projects/${ projectId } ` )
22
+ . get ( `${ config . TC_API_V5_BASE_URL } /projects/${ projectId } ` )
23
23
. set ( 'accept' , 'application/json' )
24
24
. set ( 'authorization' , `Bearer ${ token } ` )
25
25
. then ( ( res ) => {
26
- if ( ! _ . get ( res , 'body.result.success' ) ) {
26
+ const project = res . body ;
27
+ if ( ! project ) {
27
28
throw new Error ( `Failed to get project details of project id: ${ projectId } ` ) ;
28
29
}
29
- const project = _ . get ( res , 'body.result.content' ) ;
30
30
return project ;
31
31
} ) . catch ( ( err ) => {
32
- const errorDetails = _ . get ( err , 'response.body.result.content. message' ) ;
32
+ const errorDetails = _ . get ( err , 'response.body.message' ) ;
33
33
throw new Error (
34
34
`Failed to get project details of project id: ${ projectId } .` +
35
35
( errorDetails ? ' Server response: ' + errorDetails : '' )
@@ -244,17 +244,17 @@ const getPhase = (projectId, phaseId) => (
244
244
M2m . getMachineToken ( config . AUTH0_CLIENT_ID , config . AUTH0_CLIENT_SECRET )
245
245
. then ( ( token ) => (
246
246
request
247
- . get ( `${ config . TC_API_V4_BASE_URL } /projects/${ projectId } /phases/${ phaseId } ` )
247
+ . get ( `${ config . TC_API_V5_BASE_URL } /projects/${ projectId } /phases/${ phaseId } ` )
248
248
. set ( 'accept' , 'application/json' )
249
249
. set ( 'authorization' , `Bearer ${ token } ` )
250
250
. then ( ( res ) => {
251
- if ( ! _ . get ( res , 'body.result.success' ) ) {
251
+ const project = res . body ;
252
+ if ( ! project ) {
252
253
throw new Error ( `Failed to get phase details of project id: ${ projectId } , phase id: ${ phaseId } ` ) ;
253
254
}
254
- const project = _ . get ( res , 'body.result.content' ) ;
255
255
return project ;
256
256
} ) . catch ( ( err ) => {
257
- const errorDetails = _ . get ( err , 'response.body.result.content. message' ) ;
257
+ const errorDetails = _ . get ( err , 'response.body.message' ) ;
258
258
throw new Error (
259
259
`Failed to get phase details of project id: ${ projectId } , phase id: ${ phaseId } .` +
260
260
( errorDetails ? ' Server response: ' + errorDetails : '' )
0 commit comments