From d8aa5b5ff48dee968f02d3e8a6ddaa0fad9212c9 Mon Sep 17 00:00:00 2001 From: Reginald Bondoc Date: Wed, 30 Nov 2022 23:39:23 +0100 Subject: [PATCH] I-36 Remove dependency to PATH const --- frontend/components/utilities/SecurityClient.js | 5 +---- frontend/const.js | 2 -- frontend/pages/api/auth/ChangePassword2.js | 3 +-- frontend/pages/api/auth/CheckAuth.js | 3 +-- frontend/pages/api/auth/CheckEmailVerificationCode.js | 4 +--- frontend/pages/api/auth/CompleteAccountInformationSignup.js | 4 +--- .../pages/api/auth/CompleteAccountInformationSignupInvite.js | 4 +--- frontend/pages/api/auth/IssueBackupPrivateKey.js | 3 +-- frontend/pages/api/auth/Login1.js | 4 +--- frontend/pages/api/auth/Login2.js | 4 +--- frontend/pages/api/auth/Logout.js | 3 +-- frontend/pages/api/auth/SRP1.js | 3 +-- frontend/pages/api/auth/SendVerificationEmail.js | 4 +--- frontend/pages/api/auth/Token.js | 4 +--- frontend/pages/api/auth/VerifySignupInvite.js | 4 +--- frontend/pages/api/auth/publicKeyInfisical.js | 4 +--- frontend/pages/api/files/GetSecrets.js | 2 -- frontend/pages/api/files/UploadSecrets.js | 3 +-- frontend/pages/api/integrations/ChangeHerokuConfigVars.js | 3 +-- frontend/pages/api/integrations/DeleteIntegration.js | 3 +-- frontend/pages/api/integrations/DeleteIntegrationAuth.js | 3 +-- frontend/pages/api/integrations/GetIntegrationApps.js | 3 +-- frontend/pages/api/integrations/GetIntegrations.js | 3 +-- frontend/pages/api/integrations/StartIntegration.js | 3 +-- frontend/pages/api/integrations/authorizeIntegration.js | 3 +-- .../pages/api/integrations/getWorkspaceAuthorizations.js | 3 +-- frontend/pages/api/integrations/getWorkspaceIntegrations.js | 3 +-- frontend/pages/api/organization/GetOrg.js | 3 +-- frontend/pages/api/organization/GetOrgProjects.js | 3 +-- frontend/pages/api/organization/GetOrgSubscription.js | 3 +-- frontend/pages/api/organization/GetOrgUserProjects.js | 3 +-- frontend/pages/api/organization/GetOrgUsers.js | 3 +-- frontend/pages/api/organization/StripeRedirect.js | 3 +-- frontend/pages/api/organization/addIncidentContact.js | 3 +-- frontend/pages/api/organization/addUserToOrg.js | 3 +-- frontend/pages/api/organization/deleteIncidentContact.js | 3 +-- .../pages/api/organization/deleteUserFromOrganization.js | 3 +-- frontend/pages/api/organization/getIncidentContacts.js | 3 +-- frontend/pages/api/organization/getOrgs.js | 3 +-- frontend/pages/api/organization/renameOrg.js | 3 +-- frontend/pages/api/serviceToken/addServiceToken.js | 3 +-- frontend/pages/api/serviceToken/getServiceTokens.js | 3 +-- frontend/pages/api/user/getUser.js | 3 +-- frontend/pages/api/userActions/checkUserAction.js | 2 -- frontend/pages/api/userActions/registerUserAction.js | 3 +-- frontend/pages/api/workspace/addUserToWorkspace.js | 3 +-- frontend/pages/api/workspace/changeUserRoleInWorkspace.js | 3 +-- frontend/pages/api/workspace/createWorkspace.js | 3 +-- frontend/pages/api/workspace/deleteUserFromWorkspace.js | 3 +-- frontend/pages/api/workspace/deleteWorkspace.js | 3 +-- frontend/pages/api/workspace/getLatestFileKey.js | 3 +-- frontend/pages/api/workspace/getWorkspaceInfo.js | 3 +-- frontend/pages/api/workspace/getWorkspaceKeys.js | 3 +-- frontend/pages/api/workspace/getWorkspaceUsers.js | 3 +-- frontend/pages/api/workspace/getWorkspaces.js | 3 +-- frontend/pages/api/workspace/renameWorkspace.js | 3 +-- frontend/pages/api/workspace/uploadKeys.js | 3 +-- 57 files changed, 54 insertions(+), 125 deletions(-) diff --git a/frontend/components/utilities/SecurityClient.js b/frontend/components/utilities/SecurityClient.js index 645ecbb67..f8be6a0e1 100644 --- a/frontend/components/utilities/SecurityClient.js +++ b/frontend/components/utilities/SecurityClient.js @@ -1,8 +1,6 @@ -import { PATH } from "~/const"; import token from "~/pages/api/auth/Token"; export default class SecurityClient { - static authOrigins = [PATH]; static #token = ""; contructor() {} @@ -13,13 +11,12 @@ export default class SecurityClient { static async fetchCall(resource, options) { let req = new Request(resource, options); - const destOrigin = new URL(req.url).origin; if (this.#token == "") { this.setToken(await token()); } - if (this.#token && this.authOrigins.includes(destOrigin)) { + if (this.#token) { req.headers.set("Authorization", "Bearer " + this.#token); return fetch(req); } diff --git a/frontend/const.js b/frontend/const.js index 01f7dcf7e..f3b285e43 100644 --- a/frontend/const.js +++ b/frontend/const.js @@ -1,5 +1,3 @@ -export const PATH = process.env.NEXT_PUBLIC_WEBSITE_URL; - export const publicPaths = [ `/`, // `/integrations`, diff --git a/frontend/pages/api/auth/ChangePassword2.js b/frontend/pages/api/auth/ChangePassword2.js index 56db44ebf..b764e6067 100644 --- a/frontend/pages/api/auth/ChangePassword2.js +++ b/frontend/pages/api/auth/ChangePassword2.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -14,7 +13,7 @@ const changePassword2 = ({ verifier, clientProof, }) => { - return SecurityClient.fetchCall(PATH + "/api/v1/password/change-password", { + return SecurityClient.fetchCall("/api/v1/password/change-password", { method: "POST", headers: { "Content-Type": "application/json", diff --git a/frontend/pages/api/auth/CheckAuth.js b/frontend/pages/api/auth/CheckAuth.js index 5ddcb6d9a..edd373614 100644 --- a/frontend/pages/api/auth/CheckAuth.js +++ b/frontend/pages/api/auth/CheckAuth.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient.js"; /** @@ -9,7 +8,7 @@ import SecurityClient from "~/utilities/SecurityClient.js"; * @returns */ const checkAuth = async (req, res) => { - return SecurityClient.fetchCall(PATH + "/api/v1/auth/checkAuth", { + return SecurityClient.fetchCall("/api/v1/auth/checkAuth", { method: "POST", headers: { "Content-Type": "application/json", diff --git a/frontend/pages/api/auth/CheckEmailVerificationCode.js b/frontend/pages/api/auth/CheckEmailVerificationCode.js index aaf9205b6..83a64602a 100644 --- a/frontend/pages/api/auth/CheckEmailVerificationCode.js +++ b/frontend/pages/api/auth/CheckEmailVerificationCode.js @@ -1,5 +1,3 @@ -import { PATH } from "~/const"; - /** * This route check the verification code from the email that user just recieved * @param {*} email @@ -7,7 +5,7 @@ import { PATH } from "~/const"; * @returns */ const checkEmailVerificationCode = (email, code) => { - return fetch(PATH + "/api/v1/signup/email/verify", { + return fetch("/api/v1/signup/email/verify", { method: "POST", headers: { "Content-Type": "application/json", diff --git a/frontend/pages/api/auth/CompleteAccountInformationSignup.js b/frontend/pages/api/auth/CompleteAccountInformationSignup.js index b315510e5..21406e381 100644 --- a/frontend/pages/api/auth/CompleteAccountInformationSignup.js +++ b/frontend/pages/api/auth/CompleteAccountInformationSignup.js @@ -1,5 +1,3 @@ -import { PATH } from "~/const"; - /** * This function is called in the end of the signup process. * It sends all the necessary nformation to the server. @@ -28,7 +26,7 @@ const completeAccountInformationSignup = ({ verifier, token, }) => { - return fetch(PATH + "/api/v1/signup/complete-account/signup", { + return fetch("/api/v1/signup/complete-account/signup", { method: "POST", headers: { "Content-Type": "application/json", diff --git a/frontend/pages/api/auth/CompleteAccountInformationSignupInvite.js b/frontend/pages/api/auth/CompleteAccountInformationSignupInvite.js index 4af4381bd..a205e6f59 100644 --- a/frontend/pages/api/auth/CompleteAccountInformationSignupInvite.js +++ b/frontend/pages/api/auth/CompleteAccountInformationSignupInvite.js @@ -1,5 +1,3 @@ -import { PATH } from "~/const"; - /** * This function is called in the end of the signup process. * It sends all the necessary nformation to the server. @@ -26,7 +24,7 @@ const completeAccountInformationSignupInvite = ({ verifier, token, }) => { - return fetch(PATH + "/api/v1/signup/complete-account/invite", { + return fetch("/api/v1/signup/complete-account/invite", { method: "POST", headers: { "Content-Type": "application/json", diff --git a/frontend/pages/api/auth/IssueBackupPrivateKey.js b/frontend/pages/api/auth/IssueBackupPrivateKey.js index a4cff8041..43e9f64ee 100644 --- a/frontend/pages/api/auth/IssueBackupPrivateKey.js +++ b/frontend/pages/api/auth/IssueBackupPrivateKey.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -13,7 +12,7 @@ const issueBackupPrivateKey = ({ clientProof, }) => { return SecurityClient.fetchCall( - PATH + "/api/v1/password/backup-private-key", + "/api/v1/password/backup-private-key", { method: "POST", headers: { diff --git a/frontend/pages/api/auth/Login1.js b/frontend/pages/api/auth/Login1.js index 697933812..3f3493f77 100644 --- a/frontend/pages/api/auth/Login1.js +++ b/frontend/pages/api/auth/Login1.js @@ -1,5 +1,3 @@ -import { PATH } from "~/const"; - /** * This is the first step of the login process (pake) * @param {*} email @@ -7,7 +5,7 @@ import { PATH } from "~/const"; * @returns */ const login1 = (email, clientPublicKey) => { - return fetch(PATH + "/api/v1/auth/login1", { + return fetch("/api/v1/auth/login1", { method: "POST", headers: { "Content-Type": "application/json", diff --git a/frontend/pages/api/auth/Login2.js b/frontend/pages/api/auth/Login2.js index fdb48342e..923e261df 100644 --- a/frontend/pages/api/auth/Login2.js +++ b/frontend/pages/api/auth/Login2.js @@ -1,5 +1,3 @@ -import { PATH } from "~/const"; - /** * This is the second step of the login process * @param {*} email @@ -7,7 +5,7 @@ import { PATH } from "~/const"; * @returns */ const login2 = (email, clientProof) => { - return fetch(PATH + "/api/v1/auth/login2", { + return fetch("/api/v1/auth/login2", { method: "POST", headers: { "Content-Type": "application/json", diff --git a/frontend/pages/api/auth/Logout.js b/frontend/pages/api/auth/Logout.js index c5e3e4468..24c338a27 100644 --- a/frontend/pages/api/auth/Logout.js +++ b/frontend/pages/api/auth/Logout.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -9,7 +8,7 @@ import SecurityClient from "~/utilities/SecurityClient"; * @returns */ const logout = async (req, res) => { - return SecurityClient.fetchCall(PATH + "/api/v1/auth/logout", { + return SecurityClient.fetchCall("/api/v1/auth/logout", { method: "POST", headers: { "Content-Type": "application/json", diff --git a/frontend/pages/api/auth/SRP1.js b/frontend/pages/api/auth/SRP1.js index 310066040..b0fefb857 100644 --- a/frontend/pages/api/auth/SRP1.js +++ b/frontend/pages/api/auth/SRP1.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -7,7 +6,7 @@ import SecurityClient from "~/utilities/SecurityClient"; * @returns */ const SRP1 = ({ clientPublicKey }) => { - return SecurityClient.fetchCall(PATH + "/api/v1/password/srp1", { + return SecurityClient.fetchCall("/api/v1/password/srp1", { method: "POST", headers: { "Content-Type": "application/json", diff --git a/frontend/pages/api/auth/SendVerificationEmail.js b/frontend/pages/api/auth/SendVerificationEmail.js index 981c55936..ae952852d 100644 --- a/frontend/pages/api/auth/SendVerificationEmail.js +++ b/frontend/pages/api/auth/SendVerificationEmail.js @@ -1,11 +1,9 @@ -import { PATH } from "~/const"; - /** * This route send the verification email to the user's email (contains a 6-digit verification code) * @param {*} email */ const sendVerificationEmail = (email) => { - fetch(PATH + "/api/v1/signup/email/signup", { + fetch("/api/v1/signup/email/signup", { method: "POST", headers: { "Content-Type": "application/json", diff --git a/frontend/pages/api/auth/Token.js b/frontend/pages/api/auth/Token.js index 29164aec3..c3e5fd958 100644 --- a/frontend/pages/api/auth/Token.js +++ b/frontend/pages/api/auth/Token.js @@ -1,7 +1,5 @@ -import { PATH } from "~/const"; - const token = async (req, res) => { - return fetch(PATH + "/api/v1/auth/token", { + return fetch("/api/v1/auth/token", { method: "POST", headers: { "Content-Type": "application/json", diff --git a/frontend/pages/api/auth/VerifySignupInvite.js b/frontend/pages/api/auth/VerifySignupInvite.js index 19fe229f9..2a9ba4dcd 100644 --- a/frontend/pages/api/auth/VerifySignupInvite.js +++ b/frontend/pages/api/auth/VerifySignupInvite.js @@ -1,5 +1,3 @@ -import { PATH } from "~/const"; - /** * This route verifies the signup invite link * @param {*} email @@ -7,7 +5,7 @@ import { PATH } from "~/const"; * @returns */ const verifySignupInvite = ({ email, code }) => { - return fetch(PATH + "/api/v1/invite-org/verify", { + return fetch("/api/v1/invite-org/verify", { method: "POST", headers: { "Content-Type": "application/json", diff --git a/frontend/pages/api/auth/publicKeyInfisical.js b/frontend/pages/api/auth/publicKeyInfisical.js index 070096fb4..76cad1726 100644 --- a/frontend/pages/api/auth/publicKeyInfisical.js +++ b/frontend/pages/api/auth/publicKeyInfisical.js @@ -1,5 +1,3 @@ -import { PATH } from "~/const"; - /** * This route lets us get the public key of infisical. Th euser doesn't have to be authenticated since this is just the public key. * @param {*} req @@ -7,7 +5,7 @@ import { PATH } from "~/const"; * @returns */ const publicKeyInfisical = (req, res) => { - return fetch(PATH + "/api/v1/key/publicKey/infisical", { + return fetch("/api/v1/key/publicKey/infisical", { method: "GET", headers: { "Content-Type": "application/json", diff --git a/frontend/pages/api/files/GetSecrets.js b/frontend/pages/api/files/GetSecrets.js index 6f5bf1d97..fa91d0962 100644 --- a/frontend/pages/api/files/GetSecrets.js +++ b/frontend/pages/api/files/GetSecrets.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient.js"; /** @@ -9,7 +8,6 @@ import SecurityClient from "~/utilities/SecurityClient.js"; */ const getSecrets = async (workspaceId, env) => { return SecurityClient.fetchCall( - PATH + "/api/v1/secret/" + workspaceId + "?" + diff --git a/frontend/pages/api/files/UploadSecrets.js b/frontend/pages/api/files/UploadSecrets.js index 2b6dd0722..c2f94e64d 100644 --- a/frontend/pages/api/files/UploadSecrets.js +++ b/frontend/pages/api/files/UploadSecrets.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -8,7 +7,7 @@ import SecurityClient from "~/utilities/SecurityClient"; * @returns */ const uploadSecrets = async ({ workspaceId, secrets, keys, environment }) => { - return SecurityClient.fetchCall(PATH + "/api/v1/secret/" + workspaceId, { + return SecurityClient.fetchCall("/api/v1/secret/" + workspaceId, { method: "POST", headers: { "Content-Type": "application/json", diff --git a/frontend/pages/api/integrations/ChangeHerokuConfigVars.js b/frontend/pages/api/integrations/ChangeHerokuConfigVars.js index 6075ad516..118848ae6 100644 --- a/frontend/pages/api/integrations/ChangeHerokuConfigVars.js +++ b/frontend/pages/api/integrations/ChangeHerokuConfigVars.js @@ -1,9 +1,8 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; const changeHerokuConfigVars = ({ integrationId, key, secrets }) => { return SecurityClient.fetchCall( - PATH + "/api/v1/integration/" + integrationId + "/sync", + "/api/v1/integration/" + integrationId + "/sync", { method: "POST", headers: { diff --git a/frontend/pages/api/integrations/DeleteIntegration.js b/frontend/pages/api/integrations/DeleteIntegration.js index 5b3dd6ea5..7698d7eae 100644 --- a/frontend/pages/api/integrations/DeleteIntegration.js +++ b/frontend/pages/api/integrations/DeleteIntegration.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -8,7 +7,7 @@ import SecurityClient from "~/utilities/SecurityClient"; */ const deleteIntegration = ({ integrationId }) => { return SecurityClient.fetchCall( - PATH + "/api/v1/integration/" + integrationId, + "/api/v1/integration/" + integrationId, { method: "DELETE", headers: { diff --git a/frontend/pages/api/integrations/DeleteIntegrationAuth.js b/frontend/pages/api/integrations/DeleteIntegrationAuth.js index 1d8566b41..eb6106e8e 100644 --- a/frontend/pages/api/integrations/DeleteIntegrationAuth.js +++ b/frontend/pages/api/integrations/DeleteIntegrationAuth.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -8,7 +7,7 @@ import SecurityClient from "~/utilities/SecurityClient"; */ const deleteIntegrationAuth = ({ integrationAuthId }) => { return SecurityClient.fetchCall( - PATH + "/api/v1/integration-auth/" + integrationAuthId, + "/api/v1/integration-auth/" + integrationAuthId, { method: "DELETE", headers: { diff --git a/frontend/pages/api/integrations/GetIntegrationApps.js b/frontend/pages/api/integrations/GetIntegrationApps.js index e049c3006..dc0bfb4b6 100644 --- a/frontend/pages/api/integrations/GetIntegrationApps.js +++ b/frontend/pages/api/integrations/GetIntegrationApps.js @@ -1,9 +1,8 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; const getIntegrationApps = ({ integrationAuthId }) => { return SecurityClient.fetchCall( - PATH + "/api/v1/integration-auth/" + integrationAuthId + "/apps", + "/api/v1/integration-auth/" + integrationAuthId + "/apps", { method: "GET", headers: { diff --git a/frontend/pages/api/integrations/GetIntegrations.js b/frontend/pages/api/integrations/GetIntegrations.js index 90e438a6c..401c80d3b 100644 --- a/frontend/pages/api/integrations/GetIntegrations.js +++ b/frontend/pages/api/integrations/GetIntegrations.js @@ -1,8 +1,7 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; const getIntegrations = () => { - return SecurityClient.fetchCall(PATH + "/api/v1/integration/integrations", { + return SecurityClient.fetchCall("/api/v1/integration/integrations", { method: "GET", headers: { "Content-Type": "application/json", diff --git a/frontend/pages/api/integrations/StartIntegration.js b/frontend/pages/api/integrations/StartIntegration.js index a52fb1855..a4e8b0b02 100644 --- a/frontend/pages/api/integrations/StartIntegration.js +++ b/frontend/pages/api/integrations/StartIntegration.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -8,7 +7,7 @@ import SecurityClient from "~/utilities/SecurityClient"; */ const startIntegration = ({ integrationId, appName, environment }) => { return SecurityClient.fetchCall( - PATH + "/api/v1/integration/" + integrationId, + "/api/v1/integration/" + integrationId, { method: "PATCH", headers: { diff --git a/frontend/pages/api/integrations/authorizeIntegration.js b/frontend/pages/api/integrations/authorizeIntegration.js index 38dbcc713..b9a1d3995 100644 --- a/frontend/pages/api/integrations/authorizeIntegration.js +++ b/frontend/pages/api/integrations/authorizeIntegration.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -8,7 +7,7 @@ import SecurityClient from "~/utilities/SecurityClient"; */ const AuthorizeIntegration = ({ workspaceId, code, integration }) => { return SecurityClient.fetchCall( - PATH + "/api/v1/integration-auth/oauth-token", + "/api/v1/integration-auth/oauth-token", { method: "POST", headers: { diff --git a/frontend/pages/api/integrations/getWorkspaceAuthorizations.js b/frontend/pages/api/integrations/getWorkspaceAuthorizations.js index c05ae6ffc..ad8c4732b 100644 --- a/frontend/pages/api/integrations/getWorkspaceAuthorizations.js +++ b/frontend/pages/api/integrations/getWorkspaceAuthorizations.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -8,7 +7,7 @@ import SecurityClient from "~/utilities/SecurityClient"; */ const getWorkspaceAuthorizations = ({ workspaceId }) => { return SecurityClient.fetchCall( - PATH + "/api/v1/workspace/" + workspaceId + "/authorizations", + "/api/v1/workspace/" + workspaceId + "/authorizations", { method: "GET", headers: { diff --git a/frontend/pages/api/integrations/getWorkspaceIntegrations.js b/frontend/pages/api/integrations/getWorkspaceIntegrations.js index 899aeaa8a..22470e4be 100644 --- a/frontend/pages/api/integrations/getWorkspaceIntegrations.js +++ b/frontend/pages/api/integrations/getWorkspaceIntegrations.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -8,7 +7,7 @@ import SecurityClient from "~/utilities/SecurityClient"; */ const getWorkspaceIntegrations = ({ workspaceId }) => { return SecurityClient.fetchCall( - PATH + "/api/v1/workspace/" + workspaceId + "/integrations", + "/api/v1/workspace/" + workspaceId + "/integrations", { method: "GET", headers: { diff --git a/frontend/pages/api/organization/GetOrg.js b/frontend/pages/api/organization/GetOrg.js index 85414470b..74782a564 100644 --- a/frontend/pages/api/organization/GetOrg.js +++ b/frontend/pages/api/organization/GetOrg.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -8,7 +7,7 @@ import SecurityClient from "~/utilities/SecurityClient"; * @returns */ const getOrganization = (req, res) => { - return SecurityClient.fetchCall(PATH + "/api/v1/organization/" + req.orgId, { + return SecurityClient.fetchCall("/api/v1/organization/" + req.orgId, { method: "GET", headers: { "Content-Type": "application/json", diff --git a/frontend/pages/api/organization/GetOrgProjects.js b/frontend/pages/api/organization/GetOrgProjects.js index 1ff80a3eb..656fea18f 100644 --- a/frontend/pages/api/organization/GetOrgProjects.js +++ b/frontend/pages/api/organization/GetOrgProjects.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -9,7 +8,7 @@ import SecurityClient from "~/utilities/SecurityClient"; */ const getOrganizationProjects = (req, res) => { return SecurityClient.fetchCall( - PATH + "/api/organization/" + req.orgId + "/workspaces", + "/api/organization/" + req.orgId + "/workspaces", { method: "GET", headers: { diff --git a/frontend/pages/api/organization/GetOrgSubscription.js b/frontend/pages/api/organization/GetOrgSubscription.js index a983c15ed..97c6f4e5c 100644 --- a/frontend/pages/api/organization/GetOrgSubscription.js +++ b/frontend/pages/api/organization/GetOrgSubscription.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -9,7 +8,7 @@ import SecurityClient from "~/utilities/SecurityClient"; */ const getOrganizationSubscriptions = (req, res) => { return SecurityClient.fetchCall( - PATH + "/api/v1/organization/" + req.orgId + "/subscriptions", + "/api/v1/organization/" + req.orgId + "/subscriptions", { method: "GET", headers: { diff --git a/frontend/pages/api/organization/GetOrgUserProjects.js b/frontend/pages/api/organization/GetOrgUserProjects.js index fc51d18ce..c09193456 100644 --- a/frontend/pages/api/organization/GetOrgUserProjects.js +++ b/frontend/pages/api/organization/GetOrgUserProjects.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -9,7 +8,7 @@ import SecurityClient from "~/utilities/SecurityClient"; */ const getOrganizationUserProjects = (req, res) => { return SecurityClient.fetchCall( - PATH + "/api/v1/organization/" + req.orgId + "/my-workspaces", + "/api/v1/organization/" + req.orgId + "/my-workspaces", { method: "GET", headers: { diff --git a/frontend/pages/api/organization/GetOrgUsers.js b/frontend/pages/api/organization/GetOrgUsers.js index 287b07bec..feeb60477 100644 --- a/frontend/pages/api/organization/GetOrgUsers.js +++ b/frontend/pages/api/organization/GetOrgUsers.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -9,7 +8,7 @@ import SecurityClient from "~/utilities/SecurityClient"; */ const getOrganizationUsers = (req, res) => { return SecurityClient.fetchCall( - PATH + "/api/v1/organization/" + req.orgId + "/users", + "/api/v1/organization/" + req.orgId + "/users", { method: "GET", headers: { diff --git a/frontend/pages/api/organization/StripeRedirect.js b/frontend/pages/api/organization/StripeRedirect.js index 6d28d464b..e8911cf53 100644 --- a/frontend/pages/api/organization/StripeRedirect.js +++ b/frontend/pages/api/organization/StripeRedirect.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -9,7 +8,7 @@ import SecurityClient from "~/utilities/SecurityClient"; */ const StripeRedirect = ({ orgId }) => { return SecurityClient.fetchCall( - PATH + "/api/v1/organization/" + orgId + "/customer-portal-session", + "/api/v1/organization/" + orgId + "/customer-portal-session", { method: "POST", headers: { diff --git a/frontend/pages/api/organization/addIncidentContact.js b/frontend/pages/api/organization/addIncidentContact.js index b1b3d5fa9..0e6068a1a 100644 --- a/frontend/pages/api/organization/addIncidentContact.js +++ b/frontend/pages/api/organization/addIncidentContact.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -8,7 +7,7 @@ import SecurityClient from "~/utilities/SecurityClient"; */ const addIncidentContact = (organizationId, email) => { return SecurityClient.fetchCall( - PATH + "/api/v1/organization/" + organizationId + "/incidentContactOrg", + "/api/v1/organization/" + organizationId + "/incidentContactOrg", { method: "POST", headers: { diff --git a/frontend/pages/api/organization/addUserToOrg.js b/frontend/pages/api/organization/addUserToOrg.js index ccee48da3..15f22cff9 100644 --- a/frontend/pages/api/organization/addUserToOrg.js +++ b/frontend/pages/api/organization/addUserToOrg.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -8,7 +7,7 @@ import SecurityClient from "~/utilities/SecurityClient"; * @returns */ const addUserToOrg = (email, orgId) => { - return SecurityClient.fetchCall(PATH + "/api/v1/invite-org/signup", { + return SecurityClient.fetchCall("/api/v1/invite-org/signup", { method: "POST", headers: { "Content-Type": "application/json", diff --git a/frontend/pages/api/organization/deleteIncidentContact.js b/frontend/pages/api/organization/deleteIncidentContact.js index a26335d6d..f6e57c590 100644 --- a/frontend/pages/api/organization/deleteIncidentContact.js +++ b/frontend/pages/api/organization/deleteIncidentContact.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -8,7 +7,7 @@ import SecurityClient from "~/utilities/SecurityClient"; */ const deleteIncidentContact = (organizaionId, email) => { return SecurityClient.fetchCall( - PATH + "/api/v1/organization/" + organizaionId + "/incidentContactOrg", + "/api/v1/organization/" + organizaionId + "/incidentContactOrg", { method: "DELETE", headers: { diff --git a/frontend/pages/api/organization/deleteUserFromOrganization.js b/frontend/pages/api/organization/deleteUserFromOrganization.js index 269c9b2ed..66ea84793 100644 --- a/frontend/pages/api/organization/deleteUserFromOrganization.js +++ b/frontend/pages/api/organization/deleteUserFromOrganization.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -8,7 +7,7 @@ import SecurityClient from "~/utilities/SecurityClient"; */ const deleteUserFromOrganization = (membershipId) => { return SecurityClient.fetchCall( - PATH + "/api/v1/membership-org/" + membershipId, + "/api/v1/membership-org/" + membershipId, { method: "DELETE", headers: { diff --git a/frontend/pages/api/organization/getIncidentContacts.js b/frontend/pages/api/organization/getIncidentContacts.js index f2867e63c..4f3f61a48 100644 --- a/frontend/pages/api/organization/getIncidentContacts.js +++ b/frontend/pages/api/organization/getIncidentContacts.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -8,7 +7,7 @@ import SecurityClient from "~/utilities/SecurityClient"; */ const getIncidentContacts = (organizationId) => { return SecurityClient.fetchCall( - PATH + "/api/v1/organization/" + organizationId + "/incidentContactOrg", + "/api/v1/organization/" + organizationId + "/incidentContactOrg", { method: "GET", headers: { diff --git a/frontend/pages/api/organization/getOrgs.js b/frontend/pages/api/organization/getOrgs.js index 5f28f913d..6720c22a9 100644 --- a/frontend/pages/api/organization/getOrgs.js +++ b/frontend/pages/api/organization/getOrgs.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -8,7 +7,7 @@ import SecurityClient from "~/utilities/SecurityClient"; * @returns */ const getOrganizations = (req, res) => { - return SecurityClient.fetchCall(PATH + "/api/v1/organization", { + return SecurityClient.fetchCall("/api/v1/organization", { method: "GET", headers: { "Content-Type": "application/json", diff --git a/frontend/pages/api/organization/renameOrg.js b/frontend/pages/api/organization/renameOrg.js index a33c6d3a5..a9d80a3a5 100644 --- a/frontend/pages/api/organization/renameOrg.js +++ b/frontend/pages/api/organization/renameOrg.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -9,7 +8,7 @@ import SecurityClient from "~/utilities/SecurityClient"; */ const renameOrg = (orgId, newOrgName) => { return SecurityClient.fetchCall( - PATH + "/api/v1/organization/" + orgId + "/name", + "/api/v1/organization/" + orgId + "/name", { method: "PATCH", headers: { diff --git a/frontend/pages/api/serviceToken/addServiceToken.js b/frontend/pages/api/serviceToken/addServiceToken.js index 2b4a8e46e..4c6031db8 100644 --- a/frontend/pages/api/serviceToken/addServiceToken.js +++ b/frontend/pages/api/serviceToken/addServiceToken.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -15,7 +14,7 @@ const addServiceToken = ({ encryptedKey, nonce, }) => { - return SecurityClient.fetchCall(PATH + "/api/v1/service-token/", { + return SecurityClient.fetchCall("/api/v1/service-token/", { method: "POST", headers: { "Content-Type": "application/json", diff --git a/frontend/pages/api/serviceToken/getServiceTokens.js b/frontend/pages/api/serviceToken/getServiceTokens.js index 3928076cc..79c6a7fc0 100644 --- a/frontend/pages/api/serviceToken/getServiceTokens.js +++ b/frontend/pages/api/serviceToken/getServiceTokens.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -8,7 +7,7 @@ import SecurityClient from "~/utilities/SecurityClient"; */ const getServiceTokens = ({ workspaceId }) => { return SecurityClient.fetchCall( - PATH + "/api/v1/workspace/" + workspaceId + "/service-tokens", + "/api/v1/workspace/" + workspaceId + "/service-tokens", { method: "GET", headers: { diff --git a/frontend/pages/api/user/getUser.js b/frontend/pages/api/user/getUser.js index baca9239b..10ca0d5f8 100644 --- a/frontend/pages/api/user/getUser.js +++ b/frontend/pages/api/user/getUser.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -8,7 +7,7 @@ import SecurityClient from "~/utilities/SecurityClient"; * @returns */ const getUser = (req, res) => { - return SecurityClient.fetchCall(PATH + "/api/v1/user", { + return SecurityClient.fetchCall("/api/v1/user", { method: "GET", headers: { "Content-Type": "application/json", diff --git a/frontend/pages/api/userActions/checkUserAction.js b/frontend/pages/api/userActions/checkUserAction.js index 981fa74ee..dfe217856 100644 --- a/frontend/pages/api/userActions/checkUserAction.js +++ b/frontend/pages/api/userActions/checkUserAction.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -9,7 +8,6 @@ import SecurityClient from "~/utilities/SecurityClient"; */ const checkUserAction = ({ action }) => { return SecurityClient.fetchCall( - PATH + "/api/v1/user-action" + "?" + new URLSearchParams({ diff --git a/frontend/pages/api/userActions/registerUserAction.js b/frontend/pages/api/userActions/registerUserAction.js index 98a80627c..619886d89 100644 --- a/frontend/pages/api/userActions/registerUserAction.js +++ b/frontend/pages/api/userActions/registerUserAction.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -7,7 +6,7 @@ import SecurityClient from "~/utilities/SecurityClient"; * @returns */ const registerUserAction = ({ action }) => { - return SecurityClient.fetchCall(PATH + "/api/v1/user-action", { + return SecurityClient.fetchCall("/api/v1/user-action", { method: "POST", headers: { "Content-Type": "application/json", diff --git a/frontend/pages/api/workspace/addUserToWorkspace.js b/frontend/pages/api/workspace/addUserToWorkspace.js index d6caa30e4..86e991389 100644 --- a/frontend/pages/api/workspace/addUserToWorkspace.js +++ b/frontend/pages/api/workspace/addUserToWorkspace.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -9,7 +8,7 @@ import SecurityClient from "~/utilities/SecurityClient"; */ const addUserToWorkspace = (email, workspaceId) => { return SecurityClient.fetchCall( - PATH + "/api/v1/workspace/" + workspaceId + "/invite-signup", + "/api/v1/workspace/" + workspaceId + "/invite-signup", { method: "POST", headers: { diff --git a/frontend/pages/api/workspace/changeUserRoleInWorkspace.js b/frontend/pages/api/workspace/changeUserRoleInWorkspace.js index 5f37e674f..a93e22181 100644 --- a/frontend/pages/api/workspace/changeUserRoleInWorkspace.js +++ b/frontend/pages/api/workspace/changeUserRoleInWorkspace.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -9,7 +8,7 @@ import SecurityClient from "~/utilities/SecurityClient"; */ const changeUserRoleInWorkspace = (membershipId, role) => { return SecurityClient.fetchCall( - PATH + "/api/v1/membership/" + membershipId + "/change-role", + "/api/v1/membership/" + membershipId + "/change-role", { method: "POST", headers: { diff --git a/frontend/pages/api/workspace/createWorkspace.js b/frontend/pages/api/workspace/createWorkspace.js index 1451249b7..d5c44e2a6 100644 --- a/frontend/pages/api/workspace/createWorkspace.js +++ b/frontend/pages/api/workspace/createWorkspace.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -7,7 +6,7 @@ import SecurityClient from "~/utilities/SecurityClient"; * @returns */ const createWorkspace = (workspaceName, organizationId) => { - return SecurityClient.fetchCall(PATH + "/api/v1/workspace", { + return SecurityClient.fetchCall("/api/v1/workspace", { method: "POST", headers: { "Content-Type": "application/json", diff --git a/frontend/pages/api/workspace/deleteUserFromWorkspace.js b/frontend/pages/api/workspace/deleteUserFromWorkspace.js index 83389c281..bad8beced 100644 --- a/frontend/pages/api/workspace/deleteUserFromWorkspace.js +++ b/frontend/pages/api/workspace/deleteUserFromWorkspace.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -7,7 +6,7 @@ import SecurityClient from "~/utilities/SecurityClient"; * @returns */ const deleteUserFromWorkspace = (membershipId) => { - return SecurityClient.fetchCall(PATH + "/api/v1/membership/" + membershipId, { + return SecurityClient.fetchCall("/api/v1/membership/" + membershipId, { method: "DELETE", headers: { "Content-Type": "application/json", diff --git a/frontend/pages/api/workspace/deleteWorkspace.js b/frontend/pages/api/workspace/deleteWorkspace.js index c84ebe756..33d34844d 100644 --- a/frontend/pages/api/workspace/deleteWorkspace.js +++ b/frontend/pages/api/workspace/deleteWorkspace.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -7,7 +6,7 @@ import SecurityClient from "~/utilities/SecurityClient"; * @returns */ const deleteWorkspace = (workspaceId) => { - return SecurityClient.fetchCall(PATH + "/api/v1/workspace/" + workspaceId, { + return SecurityClient.fetchCall("/api/v1/workspace/" + workspaceId, { method: "DELETE", headers: { "Content-Type": "application/json", diff --git a/frontend/pages/api/workspace/getLatestFileKey.js b/frontend/pages/api/workspace/getLatestFileKey.js index e1fab97c6..a5b14520a 100644 --- a/frontend/pages/api/workspace/getLatestFileKey.js +++ b/frontend/pages/api/workspace/getLatestFileKey.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -8,7 +7,7 @@ import SecurityClient from "~/utilities/SecurityClient"; */ const getLatestFileKey = (workspaceId) => { return SecurityClient.fetchCall( - PATH + "/api/v1/key/" + workspaceId + "/latest", + "/api/v1/key/" + workspaceId + "/latest", { method: "GET", headers: { diff --git a/frontend/pages/api/workspace/getWorkspaceInfo.js b/frontend/pages/api/workspace/getWorkspaceInfo.js index 449cbd54b..4266dbbaa 100644 --- a/frontend/pages/api/workspace/getWorkspaceInfo.js +++ b/frontend/pages/api/workspace/getWorkspaceInfo.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -9,7 +8,7 @@ import SecurityClient from "~/utilities/SecurityClient"; */ const getWorkspaceInfo = (req, res) => { return SecurityClient.fetchCall( - PATH + "/api/v1/workspace/" + req.workspaceId, + "/api/v1/workspace/" + req.workspaceId, { method: "GET", headers: { diff --git a/frontend/pages/api/workspace/getWorkspaceKeys.js b/frontend/pages/api/workspace/getWorkspaceKeys.js index c94cb786e..368d00fa0 100644 --- a/frontend/pages/api/workspace/getWorkspaceKeys.js +++ b/frontend/pages/api/workspace/getWorkspaceKeys.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -9,7 +8,7 @@ import SecurityClient from "~/utilities/SecurityClient"; */ const getWorkspaceKeys = (req, res) => { return SecurityClient.fetchCall( - PATH + "/api/v1/workspace/" + req.workspaceId + "/keys", + "/api/v1/workspace/" + req.workspaceId + "/keys", { method: "GET", headers: { diff --git a/frontend/pages/api/workspace/getWorkspaceUsers.js b/frontend/pages/api/workspace/getWorkspaceUsers.js index b7c42bf88..4d87836c7 100644 --- a/frontend/pages/api/workspace/getWorkspaceUsers.js +++ b/frontend/pages/api/workspace/getWorkspaceUsers.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -9,7 +8,7 @@ import SecurityClient from "~/utilities/SecurityClient"; */ const getWorkspaceUsers = (req, res) => { return SecurityClient.fetchCall( - PATH + "/api/v1/workspace/" + req.workspaceId + "/users", + "/api/v1/workspace/" + req.workspaceId + "/users", { method: "GET", headers: { diff --git a/frontend/pages/api/workspace/getWorkspaces.js b/frontend/pages/api/workspace/getWorkspaces.js index d3b276eb7..ccaf49e9b 100644 --- a/frontend/pages/api/workspace/getWorkspaces.js +++ b/frontend/pages/api/workspace/getWorkspaces.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -8,7 +7,7 @@ import SecurityClient from "~/utilities/SecurityClient"; * @returns */ const getWorkspaces = (req, res) => { - return SecurityClient.fetchCall(PATH + "/api/v1/workspace", { + return SecurityClient.fetchCall("/api/v1/workspace", { method: "GET", headers: { "Content-Type": "application/json", diff --git a/frontend/pages/api/workspace/renameWorkspace.js b/frontend/pages/api/workspace/renameWorkspace.js index b92addd1a..6dd297f82 100644 --- a/frontend/pages/api/workspace/renameWorkspace.js +++ b/frontend/pages/api/workspace/renameWorkspace.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -9,7 +8,7 @@ import SecurityClient from "~/utilities/SecurityClient"; */ const renameWorkspace = (workspaceId, newWorkspaceName) => { return SecurityClient.fetchCall( - PATH + "/api/v1/workspace/" + workspaceId + "/name", + "/api/v1/workspace/" + workspaceId + "/name", { method: "POST", headers: { diff --git a/frontend/pages/api/workspace/uploadKeys.js b/frontend/pages/api/workspace/uploadKeys.js index a368948aa..37b384f30 100644 --- a/frontend/pages/api/workspace/uploadKeys.js +++ b/frontend/pages/api/workspace/uploadKeys.js @@ -1,4 +1,3 @@ -import { PATH } from "~/const"; import SecurityClient from "~/utilities/SecurityClient"; /** @@ -10,7 +9,7 @@ import SecurityClient from "~/utilities/SecurityClient"; * @returns */ const uploadKeys = (workspaceId, userId, encryptedKey, nonce) => { - return SecurityClient.fetchCall(PATH + "/api/v1/key/" + workspaceId, { + return SecurityClient.fetchCall("/api/v1/key/" + workspaceId, { method: "POST", headers: { "Content-Type": "application/json",