diff --git a/src/app/core/components/osf-banners/services/maintenance.service.ts b/src/app/core/components/osf-banners/services/maintenance.service.ts index 3a9011597..a18a081f4 100644 --- a/src/app/core/components/osf-banners/services/maintenance.service.ts +++ b/src/app/core/components/osf-banners/services/maintenance.service.ts @@ -19,7 +19,10 @@ export class MaintenanceService { /** Injected Angular `HttpClient` for making API requests. */ private readonly http = inject(HttpClient); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } /** * Fetches the maintenance status from the API and transforms the response. diff --git a/src/app/core/services/auth.service.ts b/src/app/core/services/auth.service.ts index bae03d98c..68d497761 100644 --- a/src/app/core/services/auth.service.ts +++ b/src/app/core/services/auth.service.ts @@ -19,11 +19,20 @@ export class AuthService { private readonly cookieService = inject(CookieService); private readonly loaderService = inject(LoaderService); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2/users/`; - private readonly webUrl = this.environment.webUrl; - private readonly casUrl = this.environment.casUrl; private readonly actions = createDispatchMap({ clearCurrentUser: ClearCurrentUser }); + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2/users/`; + } + + get webUrl() { + return this.environment.webUrl; + } + + get casUrl() { + return this.environment.casUrl; + } + navigateToSignIn(): void { this.loaderService.show(); const loginUrl = `${this.casUrl}/login?${urlParam({ service: `${this.webUrl}/login` })}`; diff --git a/src/app/core/services/request-access.service.ts b/src/app/core/services/request-access.service.ts index 993868226..324b701d9 100644 --- a/src/app/core/services/request-access.service.ts +++ b/src/app/core/services/request-access.service.ts @@ -11,7 +11,10 @@ import { JsonApiService } from '@osf/shared/services'; export class RequestAccessService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } requestAccessToProject(projectId: string, comment = ''): Observable { const payload = { diff --git a/src/app/core/services/user-emails.service.ts b/src/app/core/services/user-emails.service.ts index 7474d94d9..1ee9834e2 100644 --- a/src/app/core/services/user-emails.service.ts +++ b/src/app/core/services/user-emails.service.ts @@ -13,7 +13,10 @@ import { JsonApiService } from '@osf/shared/services'; export class UserEmailsService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly baseUrl = `${this.environment.apiDomainUrl}/v2/users`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2/users`; + } getEmails(): Observable { const params: Record = { @@ -22,7 +25,7 @@ export class UserEmailsService { }; return this.jsonApiService - .get(`${this.baseUrl}/me/settings/emails/`, params) + .get(`${this.apiUrl}/me/settings/emails/`, params) .pipe(map((response) => MapEmails(response.data))); } @@ -32,7 +35,7 @@ export class UserEmailsService { }; return this.jsonApiService - .get(`${this.baseUrl}/me/settings/emails/${emailId}/`, params) + .get(`${this.apiUrl}/me/settings/emails/${emailId}/`, params) .pipe(map((response) => MapEmail(response.data))); } @@ -55,7 +58,7 @@ export class UserEmailsService { }; return this.jsonApiService - .post(`${this.baseUrl}/${userId}/settings/emails/`, body) + .post(`${this.apiUrl}/${userId}/settings/emails/`, body) .pipe(map((response) => MapEmail(response.data))); } @@ -71,7 +74,7 @@ export class UserEmailsService { }; return this.jsonApiService - .patch(`${this.baseUrl}/me/settings/emails/${emailId}/`, body) + .patch(`${this.apiUrl}/me/settings/emails/${emailId}/`, body) .pipe(map((response) => MapEmail(response))); } @@ -87,11 +90,11 @@ export class UserEmailsService { }; return this.jsonApiService - .patch(`${this.baseUrl}/me/settings/emails/${emailId}/`, body) + .patch(`${this.apiUrl}/me/settings/emails/${emailId}/`, body) .pipe(map((response) => MapEmail(response))); } deleteEmail(emailId: string): Observable { - return this.jsonApiService.delete(`${this.baseUrl}/me/settings/emails/${emailId}/`); + return this.jsonApiService.delete(`${this.apiUrl}/me/settings/emails/${emailId}/`); } } diff --git a/src/app/core/services/user.service.ts b/src/app/core/services/user.service.ts index ac0b4990d..b4e15af1a 100644 --- a/src/app/core/services/user.service.ts +++ b/src/app/core/services/user.service.ts @@ -25,7 +25,10 @@ import { JsonApiService } from '@shared/services'; export class UserService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } getUserById(userId: string): Observable { return this.jsonApiService diff --git a/src/app/features/admin-institutions/services/institutions-admin.service.ts b/src/app/features/admin-institutions/services/institutions-admin.service.ts index 751d2b209..4b3eb4e97 100644 --- a/src/app/features/admin-institutions/services/institutions-admin.service.ts +++ b/src/app/features/admin-institutions/services/institutions-admin.service.ts @@ -34,8 +34,14 @@ import { export class InstitutionsAdminService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; - private readonly shareTroveUrl = this.environment.shareTroveUrl; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } + + get shareTroveUrl() { + return this.environment.shareTroveUrl; + } fetchDepartments(institutionId: string): Observable { return this.jsonApiService diff --git a/src/app/features/analytics/services/analytics.service.ts b/src/app/features/analytics/services/analytics.service.ts index ad9eecd6f..d621488a9 100644 --- a/src/app/features/analytics/services/analytics.service.ts +++ b/src/app/features/analytics/services/analytics.service.ts @@ -16,7 +16,10 @@ import { AnalyticsMetricsGetResponse, AnalyticsMetricsModel, RelatedCountsGetRes export class AnalyticsService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly apiDomainUrl = this.environment.apiDomainUrl; + + get apiDomainUrl() { + return this.environment.apiDomainUrl; + } private readonly urlMap = new Map([ [ResourceType.Project, 'nodes'], diff --git a/src/app/features/collections/services/add-to-collection.service.ts b/src/app/features/collections/services/add-to-collection.service.ts index a37ea3e72..6ebddb9cf 100644 --- a/src/app/features/collections/services/add-to-collection.service.ts +++ b/src/app/features/collections/services/add-to-collection.service.ts @@ -13,7 +13,10 @@ import { JsonApiService } from '@shared/services'; export class AddToCollectionService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } fetchCollectionLicenses(providerId: string): Observable { return this.jsonApiService diff --git a/src/app/features/meetings/services/meetings.service.ts b/src/app/features/meetings/services/meetings.service.ts index 3575e2989..0fed53296 100644 --- a/src/app/features/meetings/services/meetings.service.ts +++ b/src/app/features/meetings/services/meetings.service.ts @@ -22,7 +22,10 @@ import { export class MeetingsService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly baseUrl = `${this.environment.apiDomainUrl}/_/meetings/`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/_/meetings/`; + } getAllMeetings(pageNumber: number, pageSize: number, filters: SearchFilters): Observable { const params: Record = searchPreferencesToJsonApiQueryParams( @@ -34,7 +37,7 @@ export class MeetingsService { ); return this.jsonApiService - .get>(this.baseUrl, params) + .get>(this.apiUrl, params) .pipe(map((response) => MeetingsMapper.fromMeetingsGetResponse(response))); } @@ -53,13 +56,13 @@ export class MeetingsService { ); return this.jsonApiService - .get>(`${this.baseUrl}${meetingId}/submissions/`, params) + .get>(`${this.apiUrl}${meetingId}/submissions/`, params) .pipe(map((response) => MeetingsMapper.fromMeetingSubmissionGetResponse(response))); } getMeetingById(meetingId: string) { return this.jsonApiService - .get>(this.baseUrl + meetingId) + .get>(this.apiUrl + meetingId) .pipe(map((response) => MeetingsMapper.fromMeetingGetResponse(response.data))); } } diff --git a/src/app/features/metadata/services/metadata.service.ts b/src/app/features/metadata/services/metadata.service.ts index fda0c20b2..6eae237f6 100644 --- a/src/app/features/metadata/services/metadata.service.ts +++ b/src/app/features/metadata/services/metadata.service.ts @@ -27,9 +27,19 @@ import { CrossRefFundersResponse, CustomItemMetadataRecord, Metadata } from '../ export class MetadataService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly apiDomainUrl = this.environment.apiDomainUrl; - private readonly funderApiUrl = this.environment.funderApiUrl; - private readonly apiUrl = `${this.apiDomainUrl}/v2`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } + + get apiDomainUrl() { + return this.environment.apiDomainUrl; + } + + get funderApiUrl() { + return this.environment.funderApiUrl; + } + private readonly urlMap = new Map([ [ResourceType.Project, 'nodes'], [ResourceType.Registration, 'registrations'], diff --git a/src/app/features/moderation/services/moderators.service.ts b/src/app/features/moderation/services/moderators.service.ts index f8f8cc28d..57e6e62d4 100644 --- a/src/app/features/moderation/services/moderators.service.ts +++ b/src/app/features/moderation/services/moderators.service.ts @@ -18,7 +18,10 @@ import { ModeratorAddModel, ModeratorDataJsonApi, ModeratorModel, ModeratorRespo export class ModeratorsService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } private readonly urlMap = new Map([ [ResourceType.Collection, 'providers/collections'], diff --git a/src/app/features/moderation/services/preprint-moderation.service.ts b/src/app/features/moderation/services/preprint-moderation.service.ts index 070ec1589..b98d35af5 100644 --- a/src/app/features/moderation/services/preprint-moderation.service.ts +++ b/src/app/features/moderation/services/preprint-moderation.service.ts @@ -27,7 +27,10 @@ import { PreprintSubmissionPaginatedData } from '../models/preprint-submission.m export class PreprintModerationService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } getPreprintProviders(): Observable { const baseUrl = `${this.apiUrl}/providers/preprints/?filter[permissions]=view_actions,set_up_moderation`; diff --git a/src/app/features/moderation/services/registry-moderation.service.ts b/src/app/features/moderation/services/registry-moderation.service.ts index 2e81e4680..3bcd3a490 100644 --- a/src/app/features/moderation/services/registry-moderation.service.ts +++ b/src/app/features/moderation/services/registry-moderation.service.ts @@ -16,7 +16,10 @@ import { RegistryModeration, RegistryResponseJsonApi, ReviewAction, ReviewAction export class RegistryModerationService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } getRegistrySubmissions( provider: string, diff --git a/src/app/features/preprints/services/preprint-files.service.ts b/src/app/features/preprints/services/preprint-files.service.ts index 33c30c5a6..6a1186811 100644 --- a/src/app/features/preprints/services/preprint-files.service.ts +++ b/src/app/features/preprints/services/preprint-files.service.ts @@ -21,7 +21,10 @@ export class PreprintFilesService { private filesService = inject(FilesService); private jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } updateFileRelationship(preprintId: string, fileId: string): Observable { return this.jsonApiService diff --git a/src/app/features/preprints/services/preprint-licenses.service.ts b/src/app/features/preprints/services/preprint-licenses.service.ts index f7faccede..adc772aae 100644 --- a/src/app/features/preprints/services/preprint-licenses.service.ts +++ b/src/app/features/preprints/services/preprint-licenses.service.ts @@ -20,7 +20,10 @@ import { JsonApiService } from '@shared/services'; export class PreprintLicensesService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } getLicenses(providerId: string): Observable { return this.jsonApiService diff --git a/src/app/features/preprints/services/preprint-providers.service.ts b/src/app/features/preprints/services/preprint-providers.service.ts index 1f538233d..3daf1ef1c 100644 --- a/src/app/features/preprints/services/preprint-providers.service.ts +++ b/src/app/features/preprints/services/preprint-providers.service.ts @@ -18,11 +18,14 @@ import { JsonApiService } from '@shared/services'; export class PreprintProvidersService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly baseUrl = `${this.environment.apiDomainUrl}/v2/providers/preprints/`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2/providers/preprints/`; + } getPreprintProviderById(id: string): Observable { return this.jsonApiService - .get>(`${this.baseUrl}${id}/?embed=brand`) + .get>(`${this.apiUrl}${id}/?embed=brand`) .pipe(map((response) => PreprintProvidersMapper.fromPreprintProviderDetailsGetResponse(response.data))); } @@ -30,7 +33,7 @@ export class PreprintProvidersService { return this.jsonApiService .get< JsonApiResponse - >(`${this.baseUrl}?filter[advertise_on_discover_page]=true&reload=true`) + >(`${this.apiUrl}?filter[advertise_on_discover_page]=true&reload=true`) .pipe( map((response) => PreprintProvidersMapper.toPreprintProviderShortInfoFromGetResponse( @@ -42,13 +45,13 @@ export class PreprintProvidersService { getPreprintProvidersAllowingSubmissions(): Observable { return this.jsonApiService - .get>(`${this.baseUrl}?filter[allow_submissions]=true`) + .get>(`${this.apiUrl}?filter[allow_submissions]=true`) .pipe(map((response) => PreprintProvidersMapper.toPreprintProviderShortInfoFromGetResponse(response.data))); } getHighlightedSubjectsByProviderId(providerId: string): Observable { return this.jsonApiService - .get(`${this.baseUrl}${providerId}/subjects/highlighted/?page[size]=20`) + .get(`${this.apiUrl}${providerId}/subjects/highlighted/?page[size]=20`) .pipe(map((response) => PreprintProvidersMapper.fromSubjectsGetResponse(response.data))); } } diff --git a/src/app/features/preprints/services/preprints-projects.service.ts b/src/app/features/preprints/services/preprints-projects.service.ts index 04ac2616e..11c458b66 100644 --- a/src/app/features/preprints/services/preprints-projects.service.ts +++ b/src/app/features/preprints/services/preprints-projects.service.ts @@ -16,11 +16,15 @@ import { Preprint, PreprintAttributesJsonApi, PreprintLinksJsonApi, PreprintRela export class PreprintsProjectsService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } getAvailableProjects(searchTerm: StringOrNull): Observable { const params: Record = {}; params['page'] = 1; + if (searchTerm) { params['filter[title]'] = searchTerm; } diff --git a/src/app/features/preprints/services/preprints.service.ts b/src/app/features/preprints/services/preprints.service.ts index 1831db40a..11a9122f1 100644 --- a/src/app/features/preprints/services/preprints.service.ts +++ b/src/app/features/preprints/services/preprints.service.ts @@ -31,7 +31,10 @@ import { export class PreprintsService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } private domainToApiFieldMap: Record = { title: 'title', diff --git a/src/app/features/project/overview/services/project-overview.service.ts b/src/app/features/project/overview/services/project-overview.service.ts index c3df2e5a9..c06e48caa 100644 --- a/src/app/features/project/overview/services/project-overview.service.ts +++ b/src/app/features/project/overview/services/project-overview.service.ts @@ -17,7 +17,10 @@ import { ProjectOverviewResponseJsonApi, ProjectOverviewWithMeta } from '../mode export class ProjectOverviewService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } getProjectById(projectId: string): Observable { const params: Record = { diff --git a/src/app/features/project/registrations/services/registrations.service.ts b/src/app/features/project/registrations/services/registrations.service.ts index 995f24553..2048fabaf 100644 --- a/src/app/features/project/registrations/services/registrations.service.ts +++ b/src/app/features/project/registrations/services/registrations.service.ts @@ -13,7 +13,10 @@ import { JsonApiService } from '@osf/shared/services'; export class RegistrationsService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } getRegistrations(projectId: string, page: number, pageSize: number): Observable> { const params = { diff --git a/src/app/features/project/settings/services/settings.service.ts b/src/app/features/project/settings/services/settings.service.ts index 6473b765a..d7ed3df47 100644 --- a/src/app/features/project/settings/services/settings.service.ts +++ b/src/app/features/project/settings/services/settings.service.ts @@ -29,7 +29,10 @@ import { export class SettingsService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } getProjectSettings(nodeId: string): Observable { return this.jsonApiService diff --git a/src/app/features/registries/services/licenses.service.ts b/src/app/features/registries/services/licenses.service.ts index f9a00ad9d..4a05b3ccb 100644 --- a/src/app/features/registries/services/licenses.service.ts +++ b/src/app/features/registries/services/licenses.service.ts @@ -22,7 +22,10 @@ import { LicensesMapper } from '../mappers'; export class LicensesService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } getLicenses(providerId: string): Observable { return this.jsonApiService diff --git a/src/app/features/registries/services/registries.service.ts b/src/app/features/registries/services/registries.service.ts index 068411607..f31e747c9 100644 --- a/src/app/features/registries/services/registries.service.ts +++ b/src/app/features/registries/services/registries.service.ts @@ -33,7 +33,10 @@ import { SchemaActionTrigger } from '../enums'; export class RegistriesService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } createDraft( registrationSchemaId: string, diff --git a/src/app/features/registry/services/registry-components.service.ts b/src/app/features/registry/services/registry-components.service.ts index 9dd87e459..5832f7ce5 100644 --- a/src/app/features/registry/services/registry-components.service.ts +++ b/src/app/features/registry/services/registry-components.service.ts @@ -15,7 +15,10 @@ import { RegistryComponentsJsonApiResponse, RegistryComponentsResponseJsonApi } export class RegistryComponentsService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } getRegistryComponents(registryId: string, page = 1, pageSize = 10): Observable { const params: Record = { diff --git a/src/app/features/registry/services/registry-links.service.ts b/src/app/features/registry/services/registry-links.service.ts index 01388863e..fd5fd0194 100644 --- a/src/app/features/registry/services/registry-links.service.ts +++ b/src/app/features/registry/services/registry-links.service.ts @@ -20,7 +20,10 @@ import { export class RegistryLinksService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } getLinkedNodes(registryId: string, page = 1, pageSize = 10): Observable { const params: Record = { diff --git a/src/app/features/registry/services/registry-overview.service.ts b/src/app/features/registry/services/registry-overview.service.ts index 7a26d5cfc..90cb82a06 100644 --- a/src/app/features/registry/services/registry-overview.service.ts +++ b/src/app/features/registry/services/registry-overview.service.ts @@ -24,7 +24,10 @@ import { JsonApiService } from '@shared/services'; export class RegistryOverviewService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } getRegistrationById(id: string): Observable { const params = { diff --git a/src/app/features/registry/services/registry-resources.service.ts b/src/app/features/registry/services/registry-resources.service.ts index 12e143004..9d6c6012c 100644 --- a/src/app/features/registry/services/registry-resources.service.ts +++ b/src/app/features/registry/services/registry-resources.service.ts @@ -19,7 +19,10 @@ import { JsonApiService } from '@shared/services'; export class RegistryResourcesService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } getResources(registryId: string): Observable { const params = { diff --git a/src/app/features/settings/account-settings/services/account-settings.service.ts b/src/app/features/settings/account-settings/services/account-settings.service.ts index 0383c4e72..20e94078f 100644 --- a/src/app/features/settings/account-settings/services/account-settings.service.ts +++ b/src/app/features/settings/account-settings/services/account-settings.service.ts @@ -21,7 +21,10 @@ import { export class AccountSettingsService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } updateLocation(userId: string, locationId: string): Observable { const body = { diff --git a/src/app/features/settings/developer-apps/services/developer-apps.service.ts b/src/app/features/settings/developer-apps/services/developer-apps.service.ts index 81e2716e2..7fb183628 100644 --- a/src/app/features/settings/developer-apps/services/developer-apps.service.ts +++ b/src/app/features/settings/developer-apps/services/developer-apps.service.ts @@ -15,17 +15,20 @@ import { DeveloperApp, DeveloperAppCreateUpdate, DeveloperAppGetResponseJsonApi export class DeveloperApplicationsService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly baseUrl = `${this.environment.apiDomainUrl}/v2/applications/`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2/applications/`; + } getApplications(): Observable { return this.jsonApiService - .get>(this.baseUrl) + .get>(this.apiUrl) .pipe(map((responses) => responses.data.map((response) => DeveloperAppMapper.fromGetResponse(response)))); } getApplicationDetails(clientId: string): Observable { return this.jsonApiService - .get>(`${this.baseUrl}${clientId}/`) + .get>(`${this.apiUrl}${clientId}/`) .pipe(map((response) => DeveloperAppMapper.fromGetResponse(response.data))); } @@ -33,7 +36,7 @@ export class DeveloperApplicationsService { const request = DeveloperAppMapper.toCreateRequest(developerAppCreate); return this.jsonApiService - .post>(this.baseUrl, request) + .post>(this.apiUrl, request) .pipe(map((response) => DeveloperAppMapper.fromGetResponse(response.data))); } @@ -41,7 +44,7 @@ export class DeveloperApplicationsService { const request = DeveloperAppMapper.toUpdateRequest(developerAppUpdate); return this.jsonApiService - .patch(`${this.baseUrl}${clientId}/`, request) + .patch(`${this.apiUrl}${clientId}/`, request) .pipe(map((response) => DeveloperAppMapper.fromGetResponse(response))); } @@ -49,11 +52,11 @@ export class DeveloperApplicationsService { const request = DeveloperAppMapper.toResetSecretRequest(clientId); return this.jsonApiService - .patch(`${this.baseUrl}${clientId}/`, request) + .patch(`${this.apiUrl}${clientId}/`, request) .pipe(map((response) => DeveloperAppMapper.fromGetResponse(response))); } deleteApplication(clientId: string): Observable { - return this.jsonApiService.delete(`${this.baseUrl}${clientId}/`); + return this.jsonApiService.delete(`${this.apiUrl}${clientId}/`); } } diff --git a/src/app/features/settings/notifications/services/notification-subscription.service.ts b/src/app/features/settings/notifications/services/notification-subscription.service.ts index c8ff04a6c..b6461ea0b 100644 --- a/src/app/features/settings/notifications/services/notification-subscription.service.ts +++ b/src/app/features/settings/notifications/services/notification-subscription.service.ts @@ -18,7 +18,10 @@ import { JsonApiService } from '@osf/shared/services'; export class NotificationSubscriptionService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly baseUrl = `${this.environment.apiDomainUrl}/v2/subscriptions/`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2/subscriptions/`; + } getAllGlobalNotificationSubscriptions(): Observable { const params: Record = { @@ -26,7 +29,7 @@ export class NotificationSubscriptionService { }; return this.jsonApiService - .get>(this.baseUrl, params) + .get>(this.apiUrl, params) .pipe( map((responses) => responses.data.map((response) => NotificationSubscriptionMapper.fromGetResponse(response))) ); @@ -36,7 +39,7 @@ export class NotificationSubscriptionService { const request = NotificationSubscriptionMapper.toUpdateRequest(id, frequency); return this.jsonApiService - .patch(`${this.baseUrl}${id}/`, request) + .patch(`${this.apiUrl}${id}/`, request) .pipe(map((response) => NotificationSubscriptionMapper.fromGetResponse(response))); } } diff --git a/src/app/features/settings/tokens/services/tokens.service.ts b/src/app/features/settings/tokens/services/tokens.service.ts index c2d7ec26d..41f0bd75f 100644 --- a/src/app/features/settings/tokens/services/tokens.service.ts +++ b/src/app/features/settings/tokens/services/tokens.service.ts @@ -16,7 +16,10 @@ import { ScopeJsonApi, ScopeModel, TokenGetResponseJsonApi, TokenModel } from '. export class TokensService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } getScopes(): Observable { return this.jsonApiService diff --git a/src/app/shared/services/addons/addons.service.ts b/src/app/shared/services/addons/addons.service.ts index 248fb378f..d04bc4eda 100644 --- a/src/app/shared/services/addons/addons.service.ts +++ b/src/app/shared/services/addons/addons.service.ts @@ -35,8 +35,15 @@ import { JsonApiService } from '../json-api.service'; export class AddonsService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = this.environment.addonsApiUrl; - private readonly webUrl = this.environment.webUrl; + + get apiUrl() { + return this.environment.addonsApiUrl; + } + + get webUrl() { + return this.environment.webUrl; + } + private readonly currentUser = select(UserSelectors.getCurrentUser); getAddons(addonType: string): Observable { diff --git a/src/app/shared/services/banners.service.ts b/src/app/shared/services/banners.service.ts index 0f6d7c3e1..45f03bb94 100644 --- a/src/app/shared/services/banners.service.ts +++ b/src/app/shared/services/banners.service.ts @@ -24,7 +24,10 @@ export class BannersService { */ private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly apiDomainUrl = this.environment.apiDomainUrl; + + get apiDomainUrl() { + return this.environment.apiDomainUrl; + } /** * Retrieves the current banner diff --git a/src/app/shared/services/bookmarks.service.ts b/src/app/shared/services/bookmarks.service.ts index 0d489465e..4e5de6275 100644 --- a/src/app/shared/services/bookmarks.service.ts +++ b/src/app/shared/services/bookmarks.service.ts @@ -15,7 +15,10 @@ import { JsonApiService } from './json-api.service'; export class BookmarksService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } private readonly urlMap = new Map([ [ResourceType.Project, 'linked_nodes'], diff --git a/src/app/shared/services/citations.service.ts b/src/app/shared/services/citations.service.ts index 4e7a24fd4..d09cfed7a 100644 --- a/src/app/shared/services/citations.service.ts +++ b/src/app/shared/services/citations.service.ts @@ -26,7 +26,10 @@ import { JsonApiService } from './json-api.service'; export class CitationsService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } private readonly urlMap = new Map([[ResourceType.Preprint, 'preprints']]); diff --git a/src/app/shared/services/collections.service.ts b/src/app/shared/services/collections.service.ts index c5d9608ca..7cc00bf08 100644 --- a/src/app/shared/services/collections.service.ts +++ b/src/app/shared/services/collections.service.ts @@ -41,7 +41,11 @@ import { JsonApiService } from './json-api.service'; export class CollectionsService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } + private actions = createDispatchMap({ setTotalSubmissions: SetTotalSubmissions }); getCollectionProvider(collectionName: string): Observable { diff --git a/src/app/shared/services/contributors.service.ts b/src/app/shared/services/contributors.service.ts index 09255d785..9562d89d3 100644 --- a/src/app/shared/services/contributors.service.ts +++ b/src/app/shared/services/contributors.service.ts @@ -24,7 +24,10 @@ import { JsonApiService } from './json-api.service'; export class ContributorsService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } private readonly urlMap = new Map([ [ResourceType.Project, 'nodes'], diff --git a/src/app/shared/services/datacite/datacite.service.ts b/src/app/shared/services/datacite/datacite.service.ts index 23ef0cbc9..0de9087f3 100644 --- a/src/app/shared/services/datacite/datacite.service.ts +++ b/src/app/shared/services/datacite/datacite.service.ts @@ -13,9 +13,18 @@ import { DataciteEvent } from '@osf/shared/models/datacite/datacite-event.enum'; export class DataciteService { private readonly http: HttpClient = inject(HttpClient); private readonly environment = inject(ENVIRONMENT); - private readonly webUrl = this.environment.webUrl; - private readonly dataciteTrackerRepoId = this.environment.dataciteTrackerRepoId; - private readonly dataciteTrackerAddress = this.environment.dataciteTrackerAddress; + + get webUrl() { + return this.environment.webUrl; + } + + get dataciteTrackerAddress() { + return this.environment.dataciteTrackerAddress; + } + + get dataciteTrackerRepoId() { + return this.environment.dataciteTrackerRepoId; + } logIdentifiableView(trackable: Observable<{ identifiers?: Identifier[] } | null>) { return this.watchIdentifiable(trackable, DataciteEvent.VIEW); diff --git a/src/app/shared/services/duplicates.service.ts b/src/app/shared/services/duplicates.service.ts index 2303ce67b..ff89ed899 100644 --- a/src/app/shared/services/duplicates.service.ts +++ b/src/app/shared/services/duplicates.service.ts @@ -17,7 +17,10 @@ import { JsonApiService } from './json-api.service'; export class DuplicatesService { private jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } fetchAllDuplicates( resourceId: string, diff --git a/src/app/shared/services/files.service.ts b/src/app/shared/services/files.service.ts index 0c5771040..f48db712a 100644 --- a/src/app/shared/services/files.service.ts +++ b/src/app/shared/services/files.service.ts @@ -51,8 +51,14 @@ export class FilesService { readonly jsonApiService = inject(JsonApiService); readonly toastService = inject(ToastService); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; - private readonly addonsApiUrl = this.environment.addonsApiUrl; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } + + get addonsApiUrl() { + return this.environment.addonsApiUrl; + } filesFields = 'name,guid,kind,extra,size,path,materialized_path,date_modified,parent_folder,files'; diff --git a/src/app/shared/services/global-search.service.ts b/src/app/shared/services/global-search.service.ts index 4fc1be0b6..7bac36101 100644 --- a/src/app/shared/services/global-search.service.ts +++ b/src/app/shared/services/global-search.service.ts @@ -23,7 +23,10 @@ import { JsonApiService } from './json-api.service'; export class GlobalSearchService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly shareTroveUrl = this.environment.shareTroveUrl; + + get shareTroveUrl() { + return this.environment.shareTroveUrl; + } getResources(params: Record): Observable { return this.jsonApiService diff --git a/src/app/shared/services/institutions.service.ts b/src/app/shared/services/institutions.service.ts index b8e2113b4..be204138b 100644 --- a/src/app/shared/services/institutions.service.ts +++ b/src/app/shared/services/institutions.service.ts @@ -22,7 +22,11 @@ import { JsonApiService } from './json-api.service'; export class InstitutionsService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } + private readonly urlMap = new Map([ [ResourceType.Preprint, 'preprints'], [ResourceType.Agent, 'users'], diff --git a/src/app/shared/services/licenses.service.ts b/src/app/shared/services/licenses.service.ts index 0458691e2..5d8bbc91b 100644 --- a/src/app/shared/services/licenses.service.ts +++ b/src/app/shared/services/licenses.service.ts @@ -13,7 +13,10 @@ import { LicenseModel, LicensesResponseJsonApi } from '@shared/models'; export class LicensesService { private readonly http = inject(HttpClient); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } getAllLicenses(): Observable { return this.http diff --git a/src/app/shared/services/meta-tags.service.ts b/src/app/shared/services/meta-tags.service.ts index 51c483e44..36cfcdc13 100644 --- a/src/app/shared/services/meta-tags.service.ts +++ b/src/app/shared/services/meta-tags.service.ts @@ -17,9 +17,18 @@ import { MetadataRecordsService } from './metadata-records.service'; export class MetaTagsService { private readonly metadataRecords: MetadataRecordsService = inject(MetadataRecordsService); private readonly environment = inject(ENVIRONMENT); - private readonly webUrl = this.environment.webUrl; - private readonly facebookAppId = this.environment.facebookAppId; - private readonly twitterHandle = this.environment.twitterHandle; + + get webUrl() { + return this.environment.webUrl; + } + + get facebookAppId() { + return this.environment.facebookAppId; + } + + get twitterHandle() { + return this.environment.twitterHandle; + } private readonly defaultMetaTags: MetaTagsData = { type: 'article', diff --git a/src/app/shared/services/metadata-records.service.ts b/src/app/shared/services/metadata-records.service.ts index fd1aa499f..631804167 100644 --- a/src/app/shared/services/metadata-records.service.ts +++ b/src/app/shared/services/metadata-records.service.ts @@ -13,7 +13,10 @@ import { MetadataRecordFormat } from '../enums'; export class MetadataRecordsService { private readonly http: HttpClient = inject(HttpClient); private readonly environment = inject(ENVIRONMENT); - private readonly webUrl = this.environment.webUrl; + + get webUrl() { + return this.environment.webUrl; + } metadataRecordUrl(osfid: string, format: MetadataRecordFormat): string { return `${this.webUrl}/metadata/${osfid}/?format=${format}`; diff --git a/src/app/shared/services/my-resources.service.ts b/src/app/shared/services/my-resources.service.ts index 77e7583ee..aa654d9c5 100644 --- a/src/app/shared/services/my-resources.service.ts +++ b/src/app/shared/services/my-resources.service.ts @@ -32,7 +32,10 @@ export class MyResourcesService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } private buildCommonParams( filters?: MyResourcesSearchFilters, diff --git a/src/app/shared/services/node-links.service.ts b/src/app/shared/services/node-links.service.ts index 31b1ddb25..cc8070ac0 100644 --- a/src/app/shared/services/node-links.service.ts +++ b/src/app/shared/services/node-links.service.ts @@ -17,7 +17,10 @@ import { JsonApiService } from './json-api.service'; export class NodeLinksService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } createNodeLink( currentProjectId: string, diff --git a/src/app/shared/services/projects.service.ts b/src/app/shared/services/projects.service.ts index 6794397a9..e857b7267 100644 --- a/src/app/shared/services/projects.service.ts +++ b/src/app/shared/services/projects.service.ts @@ -15,7 +15,10 @@ import { JsonApiService } from './json-api.service'; export class ProjectsService { private jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } fetchProjects(userId: string, params?: Record): Observable { return this.jsonApiService diff --git a/src/app/shared/services/regions.service.ts b/src/app/shared/services/regions.service.ts index 2229a7307..634bb2de9 100644 --- a/src/app/shared/services/regions.service.ts +++ b/src/app/shared/services/regions.service.ts @@ -14,7 +14,10 @@ import { IdName, RegionsResponseJsonApi } from '../models'; export class RegionsService { private readonly http = inject(HttpClient); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } getAllRegions(): Observable { return this.http diff --git a/src/app/shared/services/registration-provider.service.ts b/src/app/shared/services/registration-provider.service.ts index 5ee13feb0..54824b6d7 100644 --- a/src/app/shared/services/registration-provider.service.ts +++ b/src/app/shared/services/registration-provider.service.ts @@ -21,7 +21,10 @@ import { JsonApiService } from './json-api.service'; export class RegistrationProviderService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } getProviderSchemas(providerId: string): Observable { return this.jsonApiService diff --git a/src/app/shared/services/resource-card.service.ts b/src/app/shared/services/resource-card.service.ts index fa79594b7..fe111dfc7 100644 --- a/src/app/shared/services/resource-card.service.ts +++ b/src/app/shared/services/resource-card.service.ts @@ -14,7 +14,10 @@ import { JsonApiService } from './json-api.service'; export class ResourceCardService { private jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } getUserRelatedCounts(userId: string): Observable { const params: Record = { diff --git a/src/app/shared/services/resource.service.ts b/src/app/shared/services/resource.service.ts index 3c6e6a622..0102a5701 100644 --- a/src/app/shared/services/resource.service.ts +++ b/src/app/shared/services/resource.service.ts @@ -26,7 +26,10 @@ export class ResourceGuidService { private jsonApiService = inject(JsonApiService); private loaderService = inject(LoaderService); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } private readonly urlMap = new Map([ [ResourceType.Project, 'nodes'], diff --git a/src/app/shared/services/social-share.service.ts b/src/app/shared/services/social-share.service.ts index 1c0b1e08a..5b34899b3 100644 --- a/src/app/shared/services/social-share.service.ts +++ b/src/app/shared/services/social-share.service.ts @@ -10,7 +10,10 @@ import { ShareableContent, SocialShareLinks } from '../models'; }) export class SocialShareService { private readonly environment = inject(ENVIRONMENT); - private readonly webUrl = this.environment.webUrl; + + get webUrl() { + return this.environment.webUrl; + } generateEmailLink(content: ShareableContent): string { const subject = encodeURIComponent(content.title); diff --git a/src/app/shared/services/subjects.service.ts b/src/app/shared/services/subjects.service.ts index 7c27c3414..c534043a0 100644 --- a/src/app/shared/services/subjects.service.ts +++ b/src/app/shared/services/subjects.service.ts @@ -17,9 +17,14 @@ import { JsonApiService } from './json-api.service'; export class SubjectsService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; - defaultProvider = this.environment.defaultProvider; + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } + + get defaultProvider() { + return this.environment.defaultProvider; + } private readonly urlMap = new Map([ [ResourceType.Project, 'nodes'], diff --git a/src/app/shared/services/view-only-links.service.ts b/src/app/shared/services/view-only-links.service.ts index 262d82e90..5b70f84fb 100644 --- a/src/app/shared/services/view-only-links.service.ts +++ b/src/app/shared/services/view-only-links.service.ts @@ -21,7 +21,10 @@ import { JsonApiService } from './json-api.service'; export class ViewOnlyLinksService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } private readonly urlMap = new Map([ [ResourceType.Project, 'nodes'], diff --git a/src/app/shared/services/wiki.service.ts b/src/app/shared/services/wiki.service.ts index babf3680a..4ed7c11fb 100644 --- a/src/app/shared/services/wiki.service.ts +++ b/src/app/shared/services/wiki.service.ts @@ -29,7 +29,10 @@ export class WikiService { private readonly jsonApiService = inject(JsonApiService); private readonly http = inject(HttpClient); private readonly environment = inject(ENVIRONMENT); - private readonly apiUrl = `${this.environment.apiDomainUrl}/v2`; + + get apiUrl() { + return `${this.environment.apiDomainUrl}/v2`; + } private readonly urlMap = new Map([ [ResourceType.Project, 'nodes'],