From b406a70e7268a46a53e4598639daba9ee05567f7 Mon Sep 17 00:00:00 2001 From: guru_sainath Date: Tue, 22 Aug 2023 01:13:51 +0530 Subject: [PATCH] fix: access environment variables is changed in services (#1930) Co-authored-by: Sainath --- apps/space/app/[workspace_slug]/[project_slug]/page.tsx | 4 +++- apps/space/next.config.js | 4 ++-- apps/space/services/api.service.ts | 6 ++---- apps/space/services/issue.service.ts | 4 +--- apps/space/services/project.service.ts | 4 +--- apps/space/services/user.service.ts | 4 +--- yarn.lock | 9 ++++++++- 7 files changed, 18 insertions(+), 17 deletions(-) diff --git a/apps/space/app/[workspace_slug]/[project_slug]/page.tsx b/apps/space/app/[workspace_slug]/[project_slug]/page.tsx index 80dd5f038..81c2b48c2 100644 --- a/apps/space/app/[workspace_slug]/[project_slug]/page.tsx +++ b/apps/space/app/[workspace_slug]/[project_slug]/page.tsx @@ -26,7 +26,9 @@ const WorkspaceProjectPage = observer(() => { const { workspace_slug, project_slug } = routerParams as { workspace_slug: string; project_slug: string }; const board = - routerSearchparams && routerSearchparams.get("board") != null && (routerSearchparams.get("board") as TIssueBoardKeys | ""); + routerSearchparams && + routerSearchparams.get("board") != null && + (routerSearchparams.get("board") as TIssueBoardKeys | ""); // updating default board view when we are in the issues page useEffect(() => { diff --git a/apps/space/next.config.js b/apps/space/next.config.js index 0dd1894bb..4128b636a 100644 --- a/apps/space/next.config.js +++ b/apps/space/next.config.js @@ -1,5 +1,5 @@ /** @type {import('next').NextConfig} */ -const path = require('path') +const path = require("path"); const nextConfig = { reactStrictMode: false, @@ -8,7 +8,7 @@ const nextConfig = { outputFileTracingRoot: path.join(__dirname, "../../"), appDir: true, }, - output: 'standalone' + output: "standalone", }; module.exports = nextConfig; diff --git a/apps/space/services/api.service.ts b/apps/space/services/api.service.ts index cd7076a7a..4cf26d9ee 100644 --- a/apps/space/services/api.service.ts +++ b/apps/space/services/api.service.ts @@ -3,14 +3,12 @@ import axios from "axios"; // js cookie import Cookies from "js-cookie"; -const base_url: string | null = "http://localhost:8000"; - abstract class APIService { protected baseURL: string; protected headers: any = {}; - constructor(baseURL: string) { - this.baseURL = base_url ? base_url : baseURL; + constructor(_baseURL: string) { + this.baseURL = _baseURL; } setRefreshToken(token: string) { diff --git a/apps/space/services/issue.service.ts b/apps/space/services/issue.service.ts index 4b40bdf5c..38b2f7a1d 100644 --- a/apps/space/services/issue.service.ts +++ b/apps/space/services/issue.service.ts @@ -1,11 +1,9 @@ // services import APIService from "services/api.service"; -const { NEXT_PUBLIC_API_BASE_URL } = process.env; - class IssueService extends APIService { constructor() { - super(NEXT_PUBLIC_API_BASE_URL || "http://localhost:8000"); + super(process.env.NEXT_PUBLIC_API_BASE_URL || "http://localhost:8000"); } async getPublicIssues(workspace_slug: string, project_slug: string): Promise { diff --git a/apps/space/services/project.service.ts b/apps/space/services/project.service.ts index 4d973051f..6f0275877 100644 --- a/apps/space/services/project.service.ts +++ b/apps/space/services/project.service.ts @@ -1,11 +1,9 @@ // services import APIService from "services/api.service"; -const { NEXT_PUBLIC_API_BASE_URL } = process.env; - class ProjectService extends APIService { constructor() { - super(NEXT_PUBLIC_API_BASE_URL || "http://localhost:8000"); + super(process.env.NEXT_PUBLIC_API_BASE_URL || "http://localhost:8000"); } async getProjectSettingsAsync(workspace_slug: string, project_slug: string): Promise { diff --git a/apps/space/services/user.service.ts b/apps/space/services/user.service.ts index d724374b6..a84358a96 100644 --- a/apps/space/services/user.service.ts +++ b/apps/space/services/user.service.ts @@ -1,11 +1,9 @@ // services import APIService from "services/api.service"; -const { NEXT_PUBLIC_API_BASE_URL } = process.env; - class UserService extends APIService { constructor() { - super(NEXT_PUBLIC_API_BASE_URL || "http://localhost:8000"); + super(process.env.NEXT_PUBLIC_API_BASE_URL || "http://localhost:8000"); } async currentUser(): Promise { diff --git a/yarn.lock b/yarn.lock index 8bc1fec30..ac134d60f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6558,13 +6558,20 @@ prosemirror-menu@^1.2.1: prosemirror-history "^1.0.0" prosemirror-state "^1.0.0" -prosemirror-model@1.18.1, prosemirror-model@^1.0.0, prosemirror-model@^1.16.0, prosemirror-model@^1.18.1, prosemirror-model@^1.19.0, prosemirror-model@^1.8.1: +prosemirror-model@^1.0.0, prosemirror-model@^1.16.0, prosemirror-model@^1.18.1, prosemirror-model@^1.8.1: version "1.18.1" resolved "https://registry.yarnpkg.com/prosemirror-model/-/prosemirror-model-1.18.1.tgz#1d5d6b6de7b983ee67a479dc607165fdef3935bd" integrity sha512-IxSVBKAEMjD7s3n8cgtwMlxAXZrC7Mlag7zYsAKDndAqnDScvSmp/UdnRTV/B33lTCVU3CCm7dyAn/rVVD0mcw== dependencies: orderedmap "^2.0.0" +prosemirror-model@^1.19.0: + version "1.19.3" + resolved "https://registry.yarnpkg.com/prosemirror-model/-/prosemirror-model-1.19.3.tgz#f0d55285487fefd962d0ac695f716f4ec6705006" + integrity sha512-tgSnwN7BS7/UM0sSARcW+IQryx2vODKX4MI7xpqY2X+iaepJdKBPc7I4aACIsDV/LTaTjt12Z56MhDr9LsyuZQ== + dependencies: + orderedmap "^2.0.0" + prosemirror-schema-basic@^1.2.0: version "1.2.2" resolved "https://registry.yarnpkg.com/prosemirror-schema-basic/-/prosemirror-schema-basic-1.2.2.tgz#6695f5175e4628aab179bf62e5568628b9cfe6c7"