From a718056b932abd4ec22f279fdb4c8d8fa73ed82f Mon Sep 17 00:00:00 2001 From: Henit Chobisa Date: Wed, 6 Sep 2023 06:25:47 +0000 Subject: [PATCH] chore: update services with publicRuntimeConfig --- web/services/ai.service.ts | 3 ++- web/services/analytics.service.ts | 3 ++- web/services/app-installations.service.ts | 3 ++- web/services/authentication.service.ts | 3 ++- web/services/cycles.service.ts | 3 ++- web/services/estimates.service.ts | 3 ++- web/services/file.service.ts | 3 ++- web/services/inbox.service.ts | 3 ++- web/services/integration/csv.services.ts | 3 ++- web/services/integration/github.service.ts | 3 ++- web/services/integration/index.ts | 3 ++- web/services/integration/jira.service.ts | 3 ++- web/services/issues.service.ts | 3 ++- web/services/modules.service.ts | 3 ++- web/services/notifications.service.ts | 3 ++- web/services/pages.service.ts | 3 ++- web/services/project-publish.service.ts | 3 ++- web/services/project.service.ts | 3 ++- web/services/reaction.service.ts | 3 ++- web/services/state.service.ts | 3 ++- web/services/user.service.ts | 3 ++- web/services/views.service.ts | 3 ++- web/services/workspace.service.ts | 3 ++- 23 files changed, 46 insertions(+), 23 deletions(-) diff --git a/web/services/ai.service.ts b/web/services/ai.service.ts index ecb1ada52..b98fdf8d3 100644 --- a/web/services/ai.service.ts +++ b/web/services/ai.service.ts @@ -1,11 +1,12 @@ // services +import getConfig from "next/config"; import APIService from "services/api.service"; import trackEventServices from "services/track-event.service"; // types import { ICurrentUserResponse, IGptResponse } from "types"; -const { NEXT_PUBLIC_API_BASE_URL } = process.env; +const { publicRuntimeConfig: { NEXT_PUBLIC_API_BASE_URL } } = getConfig(); const trackEvent = process.env.NEXT_PUBLIC_TRACK_EVENTS === "true" || process.env.NEXT_PUBLIC_TRACK_EVENTS === "1"; diff --git a/web/services/analytics.service.ts b/web/services/analytics.service.ts index 0b38f8c57..0788234cf 100644 --- a/web/services/analytics.service.ts +++ b/web/services/analytics.service.ts @@ -9,7 +9,8 @@ import { ISaveAnalyticsFormData, } from "types"; -const { NEXT_PUBLIC_API_BASE_URL } = process.env; +import getConfig from "next/config"; +const { publicRuntimeConfig: { NEXT_PUBLIC_API_BASE_URL } } = getConfig(); class AnalyticsServices extends APIService { constructor() { diff --git a/web/services/app-installations.service.ts b/web/services/app-installations.service.ts index dea6fa421..aeb85e105 100644 --- a/web/services/app-installations.service.ts +++ b/web/services/app-installations.service.ts @@ -2,7 +2,8 @@ import axios from "axios"; import APIService from "services/api.service"; -const { NEXT_PUBLIC_API_BASE_URL } = process.env; +import getConfig from "next/config"; +const { publicRuntimeConfig: { NEXT_PUBLIC_API_BASE_URL } } = getConfig(); class AppInstallationsService extends APIService { constructor() { diff --git a/web/services/authentication.service.ts b/web/services/authentication.service.ts index e4a33bff8..8ad1f4e41 100644 --- a/web/services/authentication.service.ts +++ b/web/services/authentication.service.ts @@ -2,7 +2,8 @@ import APIService from "services/api.service"; import { ICurrentUserResponse } from "types"; -const { NEXT_PUBLIC_API_BASE_URL } = process.env; +import getConfig from "next/config"; +const { publicRuntimeConfig: { NEXT_PUBLIC_API_BASE_URL } } = getConfig(); class AuthService extends APIService { constructor() { diff --git a/web/services/cycles.service.ts b/web/services/cycles.service.ts index 89cd50a2f..5eafe3068 100644 --- a/web/services/cycles.service.ts +++ b/web/services/cycles.service.ts @@ -5,7 +5,8 @@ import trackEventServices from "services/track-event.service"; // types import type { CycleDateCheckData, ICurrentUserResponse, ICycle, IIssue } from "types"; -const { NEXT_PUBLIC_API_BASE_URL } = process.env; +import getConfig from "next/config"; +const { publicRuntimeConfig: { NEXT_PUBLIC_API_BASE_URL } } = getConfig(); const trackEvent = process.env.NEXT_PUBLIC_TRACK_EVENTS === "true" || process.env.NEXT_PUBLIC_TRACK_EVENTS === "1"; diff --git a/web/services/estimates.service.ts b/web/services/estimates.service.ts index 8b0fe25f4..26047d5c8 100644 --- a/web/services/estimates.service.ts +++ b/web/services/estimates.service.ts @@ -4,7 +4,8 @@ import APIService from "services/api.service"; import type { ICurrentUserResponse, IEstimate, IEstimateFormData } from "types"; import trackEventServices from "services/track-event.service"; -const { NEXT_PUBLIC_API_BASE_URL } = process.env; +import getConfig from "next/config"; +const { publicRuntimeConfig: { NEXT_PUBLIC_API_BASE_URL } } = getConfig(); const trackEvent = process.env.NEXT_PUBLIC_TRACK_EVENTS === "true" || process.env.NEXT_PUBLIC_TRACK_EVENTS === "1"; diff --git a/web/services/file.service.ts b/web/services/file.service.ts index d2f01428d..a32bd00c1 100644 --- a/web/services/file.service.ts +++ b/web/services/file.service.ts @@ -1,7 +1,8 @@ // services import APIService from "services/api.service"; -const { NEXT_PUBLIC_API_BASE_URL } = process.env; +import getConfig from "next/config"; +const { publicRuntimeConfig: { NEXT_PUBLIC_API_BASE_URL } } = getConfig(); interface UnSplashImage { id: string; diff --git a/web/services/inbox.service.ts b/web/services/inbox.service.ts index 61949c877..19b28484e 100644 --- a/web/services/inbox.service.ts +++ b/web/services/inbox.service.ts @@ -1,7 +1,8 @@ import APIService from "services/api.service"; import trackEventServices from "services/track-event.service"; -const { NEXT_PUBLIC_API_BASE_URL } = process.env; +import getConfig from "next/config"; +const { publicRuntimeConfig: { NEXT_PUBLIC_API_BASE_URL } } = getConfig(); const trackEvent = process.env.NEXT_PUBLIC_TRACK_EVENTS === "true" || process.env.NEXT_PUBLIC_TRACK_EVENTS === "1"; diff --git a/web/services/integration/csv.services.ts b/web/services/integration/csv.services.ts index f19cc4a74..68fd8cb0e 100644 --- a/web/services/integration/csv.services.ts +++ b/web/services/integration/csv.services.ts @@ -3,7 +3,8 @@ import trackEventServices from "services/track-event.service"; import { ICurrentUserResponse } from "types"; -const { NEXT_PUBLIC_API_BASE_URL } = process.env; +import getConfig from "next/config"; +const { publicRuntimeConfig: { NEXT_PUBLIC_API_BASE_URL } } = getConfig(); const trackEvent = process.env.NEXT_PUBLIC_TRACK_EVENTS === "true" || process.env.NEXT_PUBLIC_TRACK_EVENTS === "1"; diff --git a/web/services/integration/github.service.ts b/web/services/integration/github.service.ts index 494785f04..c1807832a 100644 --- a/web/services/integration/github.service.ts +++ b/web/services/integration/github.service.ts @@ -3,7 +3,8 @@ import trackEventServices from "services/track-event.service"; import { ICurrentUserResponse, IGithubRepoInfo, IGithubServiceImportFormData } from "types"; -const { NEXT_PUBLIC_API_BASE_URL } = process.env; +import getConfig from "next/config"; +const { publicRuntimeConfig: { NEXT_PUBLIC_API_BASE_URL } } = getConfig(); const trackEvent = process.env.NEXT_PUBLIC_TRACK_EVENTS === "true" || process.env.NEXT_PUBLIC_TRACK_EVENTS === "1"; diff --git a/web/services/integration/index.ts b/web/services/integration/index.ts index 2b32a5bd0..2902ceba7 100644 --- a/web/services/integration/index.ts +++ b/web/services/integration/index.ts @@ -10,7 +10,8 @@ import { IExportServiceResponse, } from "types"; -const { NEXT_PUBLIC_API_BASE_URL } = process.env; +import getConfig from "next/config"; +const { publicRuntimeConfig: { NEXT_PUBLIC_API_BASE_URL } } = getConfig(); const trackEvent = process.env.NEXT_PUBLIC_TRACK_EVENTS === "true" || process.env.NEXT_PUBLIC_TRACK_EVENTS === "1"; diff --git a/web/services/integration/jira.service.ts b/web/services/integration/jira.service.ts index 8f6a9fec9..f14bd221b 100644 --- a/web/services/integration/jira.service.ts +++ b/web/services/integration/jira.service.ts @@ -4,7 +4,8 @@ import trackEventServices from "services/track-event.service"; // types import { IJiraMetadata, IJiraResponse, IJiraImporterForm, ICurrentUserResponse } from "types"; -const { NEXT_PUBLIC_API_BASE_URL } = process.env; +import getConfig from "next/config"; +const { publicRuntimeConfig: { NEXT_PUBLIC_API_BASE_URL } } = getConfig(); const trackEvent = process.env.NEXT_PUBLIC_TRACK_EVENTS === "true" || process.env.NEXT_PUBLIC_TRACK_EVENTS === "1"; diff --git a/web/services/issues.service.ts b/web/services/issues.service.ts index b8875e6c5..85a0577e9 100644 --- a/web/services/issues.service.ts +++ b/web/services/issues.service.ts @@ -12,7 +12,8 @@ import type { ISubIssueResponse, } from "types"; -const { NEXT_PUBLIC_API_BASE_URL } = process.env; +import getConfig from "next/config"; +const { publicRuntimeConfig: { NEXT_PUBLIC_API_BASE_URL } } = getConfig(); const trackEvent = process.env.NEXT_PUBLIC_TRACK_EVENTS === "true" || process.env.NEXT_PUBLIC_TRACK_EVENTS === "1"; diff --git a/web/services/modules.service.ts b/web/services/modules.service.ts index 0e3b5cfe2..37e6ee7ea 100644 --- a/web/services/modules.service.ts +++ b/web/services/modules.service.ts @@ -5,7 +5,8 @@ import trackEventServices from "./track-event.service"; // types import type { IIssueViewOptions, IModule, IIssue, ICurrentUserResponse } from "types"; -const { NEXT_PUBLIC_API_BASE_URL } = process.env; +import getConfig from "next/config"; +const { publicRuntimeConfig: { NEXT_PUBLIC_API_BASE_URL } } = getConfig(); const trackEvent = process.env.NEXT_PUBLIC_TRACK_EVENTS === "true" || process.env.NEXT_PUBLIC_TRACK_EVENTS === "1"; diff --git a/web/services/notifications.service.ts b/web/services/notifications.service.ts index 01c139b51..b9e316cc3 100644 --- a/web/services/notifications.service.ts +++ b/web/services/notifications.service.ts @@ -1,7 +1,8 @@ // services import APIService from "services/api.service"; -const { NEXT_PUBLIC_API_BASE_URL } = process.env; +import getConfig from "next/config"; +const { publicRuntimeConfig: { NEXT_PUBLIC_API_BASE_URL } } = getConfig(); // types import type { diff --git a/web/services/pages.service.ts b/web/services/pages.service.ts index 72b12012e..ecb286f45 100644 --- a/web/services/pages.service.ts +++ b/web/services/pages.service.ts @@ -5,7 +5,8 @@ import trackEventServices from "services/track-event.service"; // types import { IPage, IPageBlock, RecentPagesResponse, IIssue, ICurrentUserResponse } from "types"; -const { NEXT_PUBLIC_API_BASE_URL } = process.env; +import getConfig from "next/config"; +const { publicRuntimeConfig: { NEXT_PUBLIC_API_BASE_URL } } = getConfig(); const trackEvent = process.env.NEXT_PUBLIC_TRACK_EVENTS === "true" || process.env.NEXT_PUBLIC_TRACK_EVENTS === "1"; diff --git a/web/services/project-publish.service.ts b/web/services/project-publish.service.ts index 4ee01a94b..4ccc997bb 100644 --- a/web/services/project-publish.service.ts +++ b/web/services/project-publish.service.ts @@ -5,7 +5,8 @@ import trackEventServices from "services/track-event.service"; import { ICurrentUserResponse } from "types"; import { IProjectPublishSettings } from "store/project-publish"; -const { NEXT_PUBLIC_API_BASE_URL } = process.env; +import getConfig from "next/config"; +const { publicRuntimeConfig: { NEXT_PUBLIC_API_BASE_URL } } = getConfig(); const trackEvent = process.env.NEXT_PUBLIC_TRACK_EVENTS === "true" || process.env.NEXT_PUBLIC_TRACK_EVENTS === "1"; diff --git a/web/services/project.service.ts b/web/services/project.service.ts index 0c2712c56..0b237593e 100644 --- a/web/services/project.service.ts +++ b/web/services/project.service.ts @@ -16,7 +16,8 @@ import type { TProjectIssuesSearchParams, } from "types"; -const { NEXT_PUBLIC_API_BASE_URL } = process.env; +import getConfig from "next/config"; +const { publicRuntimeConfig: { NEXT_PUBLIC_API_BASE_URL } } = getConfig(); const trackEvent = process.env.NEXT_PUBLIC_TRACK_EVENTS === "true" || process.env.NEXT_PUBLIC_TRACK_EVENTS === "1"; diff --git a/web/services/reaction.service.ts b/web/services/reaction.service.ts index 3ba8a83e4..8f1f5f5db 100644 --- a/web/services/reaction.service.ts +++ b/web/services/reaction.service.ts @@ -11,7 +11,8 @@ import type { IssueCommentReactionForm, } from "types"; -const { NEXT_PUBLIC_API_BASE_URL } = process.env; +import getConfig from "next/config"; +const { publicRuntimeConfig: { NEXT_PUBLIC_API_BASE_URL } } = getConfig(); const trackEvent = process.env.NEXT_PUBLIC_TRACK_EVENTS === "true" || process.env.NEXT_PUBLIC_TRACK_EVENTS === "1"; diff --git a/web/services/state.service.ts b/web/services/state.service.ts index 52481f8bb..0183ef39b 100644 --- a/web/services/state.service.ts +++ b/web/services/state.service.ts @@ -2,7 +2,8 @@ import APIService from "services/api.service"; import trackEventServices from "services/track-event.service"; -const { NEXT_PUBLIC_API_BASE_URL } = process.env; +import getConfig from "next/config"; +const { publicRuntimeConfig: { NEXT_PUBLIC_API_BASE_URL } } = getConfig(); const trackEvent = process.env.NEXT_PUBLIC_TRACK_EVENTS === "true" || process.env.NEXT_PUBLIC_TRACK_EVENTS === "1"; diff --git a/web/services/user.service.ts b/web/services/user.service.ts index 0e5def647..4210df319 100644 --- a/web/services/user.service.ts +++ b/web/services/user.service.ts @@ -12,7 +12,8 @@ import type { IUserWorkspaceDashboard, } from "types"; -const { NEXT_PUBLIC_API_BASE_URL } = process.env; +import getConfig from "next/config"; +const { publicRuntimeConfig: { NEXT_PUBLIC_API_BASE_URL } } = getConfig(); const trackEvent = process.env.NEXT_PUBLIC_TRACK_EVENTS === "true" || process.env.NEXT_PUBLIC_TRACK_EVENTS === "1"; diff --git a/web/services/views.service.ts b/web/services/views.service.ts index e1d25925e..938ed59ce 100644 --- a/web/services/views.service.ts +++ b/web/services/views.service.ts @@ -6,7 +6,8 @@ import { ICurrentUserResponse } from "types"; // types import { IView } from "types/views"; -const { NEXT_PUBLIC_API_BASE_URL } = process.env; +import getConfig from "next/config"; +const { publicRuntimeConfig: { NEXT_PUBLIC_API_BASE_URL } } = getConfig(); const trackEvent = process.env.NEXT_PUBLIC_TRACK_EVENTS === "true" || process.env.NEXT_PUBLIC_TRACK_EVENTS === "1"; diff --git a/web/services/workspace.service.ts b/web/services/workspace.service.ts index 8097253e6..2e6ee6b4d 100644 --- a/web/services/workspace.service.ts +++ b/web/services/workspace.service.ts @@ -2,7 +2,8 @@ import APIService from "services/api.service"; import trackEventServices from "services/track-event.service"; -const { NEXT_PUBLIC_API_BASE_URL } = process.env; +import getConfig from "next/config"; +const { publicRuntimeConfig: { NEXT_PUBLIC_API_BASE_URL } } = getConfig(); // types import {