@@ -19,17 +19,17 @@ const getProject = (projectId) => (
1919 M2m . getMachineToken ( config . AUTH0_CLIENT_ID , config . AUTH0_CLIENT_SECRET )
2020 . then ( ( token ) => (
2121 request
22- . get ( `${ config . TC_API_V4_BASE_URL } /projects/${ projectId } ` )
22+ . get ( `${ config . TC_API_V5_BASE_URL } /projects/${ projectId } ` )
2323 . set ( 'accept' , 'application/json' )
2424 . set ( 'authorization' , `Bearer ${ token } ` )
2525 . then ( ( res ) => {
26- if ( ! _ . get ( res , 'body.result.success' ) ) {
26+ const project = res . body ;
27+ if ( ! project ) {
2728 throw new Error ( `Failed to get project details of project id: ${ projectId } ` ) ;
2829 }
29- const project = _ . get ( res , 'body.result.content' ) ;
3030 return project ;
3131 } ) . catch ( ( err ) => {
32- const errorDetails = _ . get ( err , 'response.body.result.content. message' ) ;
32+ const errorDetails = _ . get ( err , 'response.body.message' ) ;
3333 throw new Error (
3434 `Failed to get project details of project id: ${ projectId } .` +
3535 ( errorDetails ? ' Server response: ' + errorDetails : '' )
@@ -244,17 +244,17 @@ const getPhase = (projectId, phaseId) => (
244244 M2m . getMachineToken ( config . AUTH0_CLIENT_ID , config . AUTH0_CLIENT_SECRET )
245245 . then ( ( token ) => (
246246 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 } ` )
248248 . set ( 'accept' , 'application/json' )
249249 . set ( 'authorization' , `Bearer ${ token } ` )
250250 . then ( ( res ) => {
251- if ( ! _ . get ( res , 'body.result.success' ) ) {
251+ const project = res . body ;
252+ if ( ! project ) {
252253 throw new Error ( `Failed to get phase details of project id: ${ projectId } , phase id: ${ phaseId } ` ) ;
253254 }
254- const project = _ . get ( res , 'body.result.content' ) ;
255255 return project ;
256256 } ) . catch ( ( err ) => {
257- const errorDetails = _ . get ( err , 'response.body.result.content. message' ) ;
257+ const errorDetails = _ . get ( err , 'response.body.message' ) ;
258258 throw new Error (
259259 `Failed to get phase details of project id: ${ projectId } , phase id: ${ phaseId } .` +
260260 ( errorDetails ? ' Server response: ' + errorDetails : '' )
0 commit comments