3
3
import _ from 'lodash' ;
4
4
import superagent from 'superagent' ;
5
5
import superagentPromise from 'superagent-promise' ;
6
- import config from '../../ config/default ' ;
6
+ import config from '../config/index ' ;
7
7
8
8
// DEMO: emulate API requests with dummy data for demo purposes
9
9
@@ -467,13 +467,13 @@ const testUser = {
467
467
} ;
468
468
469
469
const register = ( ) => request
470
- . post ( `${ config . API_BASE_PATH } /api/v1/register` )
470
+ . post ( `${ config . api . basePath } /api/v1/register` )
471
471
. send ( testUser )
472
472
. set ( 'Content-Type' , 'application/json' )
473
473
. end ( ) ;
474
474
475
475
const authorize = ( ) => request
476
- . post ( `${ config . API_BASE_PATH } /api/v1/login` )
476
+ . post ( `${ config . api . basePath } /api/v1/login` )
477
477
. set ( 'Content-Type' , 'application/json' )
478
478
. send ( _ . pick ( testUser , 'email' , 'password' ) )
479
479
. end ( ) ;
@@ -505,12 +505,12 @@ export default class APIService {
505
505
const accessToken = authRes . body . accessToken ;
506
506
507
507
return request
508
- . get ( `${ config . API_BASE_PATH } /api/v1/missions` )
508
+ . get ( `${ config . api . basePath } /api/v1/missions` )
509
509
. set ( 'Authorization' , `Bearer ${ accessToken } ` )
510
510
. end ( )
511
511
. then ( ( res ) => res . body . items . map ( ( item ) => ( {
512
512
...item ,
513
- downloadLink : `${ config . API_BASE_PATH } /api/v1/missions/${ item . id } /download?token=${ accessToken } ` ,
513
+ downloadLink : `${ config . api . basePath } /api/v1/missions/${ item . id } /download?token=${ accessToken } ` ,
514
514
} ) ) ) ;
515
515
} ) ;
516
516
}
@@ -520,7 +520,7 @@ export default class APIService {
520
520
const accessToken = authRes . body . accessToken ;
521
521
522
522
return request
523
- . get ( `${ config . API_BASE_PATH } /api/v1/missions/${ id } ` )
523
+ . get ( `${ config . api . basePath } /api/v1/missions/${ id } ` )
524
524
. set ( 'Authorization' , `Bearer ${ accessToken } ` )
525
525
. end ( )
526
526
. then ( ( res ) => res . body ) ;
@@ -532,7 +532,7 @@ export default class APIService {
532
532
const accessToken = authRes . body . accessToken ;
533
533
534
534
return request
535
- . post ( `${ config . API_BASE_PATH } /api/v1/missions` )
535
+ . post ( `${ config . api . basePath } /api/v1/missions` )
536
536
. set ( 'Authorization' , `Bearer ${ accessToken } ` )
537
537
. send ( values )
538
538
. end ( )
@@ -545,7 +545,7 @@ export default class APIService {
545
545
const accessToken = authRes . body . accessToken ;
546
546
547
547
return request
548
- . put ( `${ config . API_BASE_PATH } /api/v1/missions/${ id } ` )
548
+ . put ( `${ config . api . basePath } /api/v1/missions/${ id } ` )
549
549
. set ( 'Authorization' , `Bearer ${ accessToken } ` )
550
550
. send ( values )
551
551
. end ( )
@@ -558,7 +558,7 @@ export default class APIService {
558
558
const accessToken = authRes . body . accessToken ;
559
559
560
560
return request
561
- . del ( `${ config . API_BASE_PATH } /api/v1/missions/${ id } ` )
561
+ . del ( `${ config . api . basePath } /api/v1/missions/${ id } ` )
562
562
. set ( 'Authorization' , `Bearer ${ accessToken } ` )
563
563
. end ( )
564
564
. then ( ( res ) => res . body ) ;
@@ -574,7 +574,7 @@ export default class APIService {
574
574
*/
575
575
static searchDrones ( params ) {
576
576
return request
577
- . get ( `${ config . API_BASE_PATH } /api/v1/drones` )
577
+ . get ( `${ config . api . basePath } /api/v1/drones` )
578
578
. query ( params )
579
579
. end ( ) ;
580
580
}
0 commit comments