@@ -13,7 +13,10 @@ import { JsonApiService } from '@osf/shared/services';
1313export class UserEmailsService {
1414 private readonly jsonApiService = inject ( JsonApiService ) ;
1515 private readonly environment = inject ( ENVIRONMENT ) ;
16- private readonly baseUrl = `${ this . environment . apiDomainUrl } /v2/users` ;
16+
17+ get apiUrl ( ) {
18+ return `${ this . environment . apiDomainUrl } /v2/users` ;
19+ }
1720
1821 getEmails ( ) : Observable < AccountEmailModel [ ] > {
1922 const params : Record < string , string > = {
@@ -22,7 +25,7 @@ export class UserEmailsService {
2225 } ;
2326
2427 return this . jsonApiService
25- . get < EmailsResponseJsonApi > ( `${ this . baseUrl } /me/settings/emails/` , params )
28+ . get < EmailsResponseJsonApi > ( `${ this . apiUrl } /me/settings/emails/` , params )
2629 . pipe ( map ( ( response ) => MapEmails ( response . data ) ) ) ;
2730 }
2831
@@ -32,7 +35,7 @@ export class UserEmailsService {
3235 } ;
3336
3437 return this . jsonApiService
35- . get < EmailResponseJsonApi > ( `${ this . baseUrl } /me/settings/emails/${ emailId } /` , params )
38+ . get < EmailResponseJsonApi > ( `${ this . apiUrl } /me/settings/emails/${ emailId } /` , params )
3639 . pipe ( map ( ( response ) => MapEmail ( response . data ) ) ) ;
3740 }
3841
@@ -55,7 +58,7 @@ export class UserEmailsService {
5558 } ;
5659
5760 return this . jsonApiService
58- . post < EmailResponseJsonApi > ( `${ this . baseUrl } /${ userId } /settings/emails/` , body )
61+ . post < EmailResponseJsonApi > ( `${ this . apiUrl } /${ userId } /settings/emails/` , body )
5962 . pipe ( map ( ( response ) => MapEmail ( response . data ) ) ) ;
6063 }
6164
@@ -71,7 +74,7 @@ export class UserEmailsService {
7174 } ;
7275
7376 return this . jsonApiService
74- . patch < EmailsDataJsonApi > ( `${ this . baseUrl } /me/settings/emails/${ emailId } /` , body )
77+ . patch < EmailsDataJsonApi > ( `${ this . apiUrl } /me/settings/emails/${ emailId } /` , body )
7578 . pipe ( map ( ( response ) => MapEmail ( response ) ) ) ;
7679 }
7780
@@ -87,11 +90,11 @@ export class UserEmailsService {
8790 } ;
8891
8992 return this . jsonApiService
90- . patch < EmailsDataJsonApi > ( `${ this . baseUrl } /me/settings/emails/${ emailId } /` , body )
93+ . patch < EmailsDataJsonApi > ( `${ this . apiUrl } /me/settings/emails/${ emailId } /` , body )
9194 . pipe ( map ( ( response ) => MapEmail ( response ) ) ) ;
9295 }
9396
9497 deleteEmail ( emailId : string ) : Observable < void > {
95- return this . jsonApiService . delete ( `${ this . baseUrl } /me/settings/emails/${ emailId } /` ) ;
98+ return this . jsonApiService . delete ( `${ this . apiUrl } /me/settings/emails/${ emailId } /` ) ;
9699 }
97100}
0 commit comments