mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 23:47:06 +00:00
Add eslint rule and fix as many issues as possible
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
interface Props {
|
||||
name: string;
|
||||
@@ -13,10 +13,10 @@ interface Props {
|
||||
* @returns
|
||||
*/
|
||||
const addAPIKey = ({ name, expiresIn }: Props) =>
|
||||
SecurityClient.fetchCall('/api/v2/api-key/', {
|
||||
method: 'POST',
|
||||
SecurityClient.fetchCall("/api/v2/api-key/", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
name,
|
||||
@@ -26,7 +26,7 @@ const addAPIKey = ({ name, expiresIn }: Props) =>
|
||||
if (res && res.status === 200) {
|
||||
return res.json();
|
||||
}
|
||||
console.log('Failed to add API key');
|
||||
console.log("Failed to add API key");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
interface Props {
|
||||
apiKeyId: string;
|
||||
@@ -12,15 +12,15 @@ interface Props {
|
||||
*/
|
||||
const deleteAPIKey = ({ apiKeyId }: Props) =>
|
||||
SecurityClient.fetchCall(`/api/v2/api-key/${apiKeyId}`, {
|
||||
method: 'DELETE',
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}).then(async (res) => {
|
||||
if (res && res.status === 200) {
|
||||
return res.json();
|
||||
}
|
||||
console.log('Failed to delete API key');
|
||||
console.log("Failed to delete API key");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
/**
|
||||
* This route gets API keys for the user
|
||||
@@ -6,16 +6,16 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
* @returns
|
||||
*/
|
||||
const getAPIKeys = () =>
|
||||
SecurityClient.fetchCall('/api/v2/api-key', {
|
||||
method: 'GET',
|
||||
SecurityClient.fetchCall("/api/v2/api-key", {
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}).then(async (res) => {
|
||||
if (res && res.status === 200) {
|
||||
return (await res.json()).apiKeyData;
|
||||
}
|
||||
console.log('Failed to get API keys');
|
||||
console.log("Failed to get API keys");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ const changePassword2 = async ({
|
||||
salt,
|
||||
verifier
|
||||
}: Props) => {
|
||||
const { data } = await apiRequest.post('/api/v1/password/change-password', {
|
||||
const { data } = await apiRequest.post("/api/v1/password/change-password", {
|
||||
clientProof,
|
||||
protectedKey,
|
||||
protectedKeyIV,
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
/**
|
||||
* This function is used to check if the user is authenticated.
|
||||
* To do that, we get their tokens from cookies, and verify if they are good.
|
||||
*/
|
||||
const checkAuth = async () =>
|
||||
SecurityClient.fetchCall('/api/v1/auth/checkAuth', {
|
||||
method: 'POST',
|
||||
SecurityClient.fetchCall("/api/v1/auth/checkAuth", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}).then((res) => res);
|
||||
|
||||
|
||||
@@ -10,10 +10,10 @@ interface Props {
|
||||
* @param {string} obj.code
|
||||
* @returns
|
||||
*/
|
||||
const checkEmailVerificationCode = ({ email, code }: Props) => fetch('/api/v1/signup/email/verify', {
|
||||
method: 'POST',
|
||||
const checkEmailVerificationCode = ({ email, code }: Props) => fetch("/api/v1/signup/email/verify", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
email,
|
||||
|
||||
@@ -55,7 +55,7 @@ const completeAccountInformationSignup = async ({
|
||||
providerAuthToken,
|
||||
attributionSource
|
||||
}: Props) => {
|
||||
const { data } = await apiRequest.post('/api/v3/signup/complete-account/signup', {
|
||||
const { data } = await apiRequest.post("/api/v3/signup/complete-account/signup", {
|
||||
email,
|
||||
firstName,
|
||||
lastName,
|
||||
|
||||
@@ -49,7 +49,7 @@ const completeAccountInformationSignupInvite = async ({
|
||||
salt,
|
||||
verifier
|
||||
}: Props) => {
|
||||
const { data } = await apiRequest.post('/api/v2/signup/complete-account/invite', {
|
||||
const { data } = await apiRequest.post("/api/v2/signup/complete-account/invite", {
|
||||
email,
|
||||
firstName,
|
||||
lastName,
|
||||
|
||||
@@ -12,10 +12,10 @@ interface Props {
|
||||
* @returns
|
||||
*/
|
||||
const EmailVerifyOnPasswordReset = async ({ email, code }: Props) => {
|
||||
const response = await fetch('/api/v1/password/email/password-reset-verify', {
|
||||
method: 'POST',
|
||||
const response = await fetch("/api/v1/password/email/password-reset-verify", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
email,
|
||||
@@ -27,7 +27,7 @@ const EmailVerifyOnPasswordReset = async ({ email, code }: Props) => {
|
||||
}
|
||||
|
||||
throw new Error(
|
||||
'Something went wrong during email verification on password reset.'
|
||||
"Something went wrong during email verification on password reset."
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
interface Props {
|
||||
encryptedPrivateKey: string;
|
||||
@@ -28,10 +28,10 @@ const issueBackupPrivateKey = ({
|
||||
verifier,
|
||||
clientProof
|
||||
}: Props) =>
|
||||
SecurityClient.fetchCall('/api/v1/password/backup-private-key', {
|
||||
method: 'POST',
|
||||
SecurityClient.fetchCall("/api/v1/password/backup-private-key", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
clientProof,
|
||||
@@ -43,7 +43,7 @@ const issueBackupPrivateKey = ({
|
||||
})
|
||||
}).then((res) => {
|
||||
if (res?.status !== 200) {
|
||||
console.log('Failed to issue the backup key');
|
||||
console.log("Failed to issue the backup key");
|
||||
}
|
||||
return res;
|
||||
});
|
||||
|
||||
@@ -22,13 +22,13 @@ const login2 = async (loginDetails: {
|
||||
clientProof: string;
|
||||
providerAuthToken?: string;
|
||||
}) => {
|
||||
const response = await fetch('/api/v3/auth/login2', {
|
||||
method: 'POST',
|
||||
const response = await fetch("/api/v3/auth/login2", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify(loginDetails),
|
||||
credentials: 'include'
|
||||
credentials: "include"
|
||||
});
|
||||
// need precise error handling about the status code
|
||||
if (response.status === 200) {
|
||||
@@ -36,7 +36,7 @@ const login2 = async (loginDetails: {
|
||||
return data;
|
||||
}
|
||||
|
||||
throw new Error('Password verification failed');
|
||||
throw new Error("Password verification failed");
|
||||
};
|
||||
|
||||
export default login2;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
/**
|
||||
* This route logs the user out. Note: the user should authorized to do this.
|
||||
@@ -6,33 +6,33 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
*/
|
||||
const logout = async () => {
|
||||
try {
|
||||
const res = await SecurityClient.fetchCall('/api/v1/auth/logout', {
|
||||
method: 'POST',
|
||||
const res = await SecurityClient.fetchCall("/api/v1/auth/logout", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
credentials: 'include'
|
||||
credentials: "include"
|
||||
});
|
||||
|
||||
if (res?.status === 200) {
|
||||
SecurityClient.setToken('');
|
||||
SecurityClient.setToken("");
|
||||
// Delete the cookie by not setting a value; Alternatively clear the local storage
|
||||
localStorage.removeItem('protectedKey');
|
||||
localStorage.removeItem('protectedKeyIV');
|
||||
localStorage.removeItem('protectedKeyTag');
|
||||
localStorage.removeItem('publicKey');
|
||||
localStorage.removeItem('encryptedPrivateKey');
|
||||
localStorage.removeItem('iv');
|
||||
localStorage.removeItem('tag');
|
||||
localStorage.removeItem('PRIVATE_KEY');
|
||||
localStorage.removeItem('orgData.id');
|
||||
localStorage.removeItem('projectData.id');
|
||||
localStorage.removeItem("protectedKey");
|
||||
localStorage.removeItem("protectedKeyIV");
|
||||
localStorage.removeItem("protectedKeyTag");
|
||||
localStorage.removeItem("publicKey");
|
||||
localStorage.removeItem("encryptedPrivateKey");
|
||||
localStorage.removeItem("iv");
|
||||
localStorage.removeItem("tag");
|
||||
localStorage.removeItem("PRIVATE_KEY");
|
||||
localStorage.removeItem("orgData.id");
|
||||
localStorage.removeItem("projectData.id");
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.log('Error logging out', error);
|
||||
console.log("Error logging out", error);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
interface Props {
|
||||
clientPublicKey: string;
|
||||
@@ -10,10 +10,10 @@ interface Props {
|
||||
* @returns
|
||||
*/
|
||||
const SRP1 = ({ clientPublicKey }: Props) =>
|
||||
SecurityClient.fetchCall('/api/v1/password/srp1', {
|
||||
method: 'POST',
|
||||
SecurityClient.fetchCall("/api/v1/password/srp1", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
clientPublicKey
|
||||
@@ -22,7 +22,7 @@ const SRP1 = ({ clientPublicKey }: Props) =>
|
||||
if (res && res.status === 200) {
|
||||
return res.json();
|
||||
}
|
||||
console.log('Failed to do the first step of SRP');
|
||||
console.log("Failed to do the first step of SRP");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -10,10 +10,10 @@ interface Props {
|
||||
* @returns
|
||||
*/
|
||||
const SendEmailOnPasswordReset = async ({ email }: Props) => {
|
||||
const response = await fetch('/api/v1/password/email/password-reset', {
|
||||
method: 'POST',
|
||||
const response = await fetch("/api/v1/password/email/password-reset", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
email
|
||||
@@ -26,7 +26,7 @@ const SendEmailOnPasswordReset = async ({ email }: Props) => {
|
||||
}
|
||||
|
||||
throw new Error(
|
||||
'Something went wrong while sending the email verification for password reset.'
|
||||
"Something went wrong while sending the email verification for password reset."
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
* @param {*} email
|
||||
*/
|
||||
const sendVerificationEmail = (email: string) => {
|
||||
fetch('/api/v1/signup/email/signup', {
|
||||
method: 'POST',
|
||||
fetch("/api/v1/signup/email/signup", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
email
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
const token = async () =>
|
||||
fetch('/api/v1/auth/token', {
|
||||
method: 'POST',
|
||||
fetch("/api/v1/auth/token", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
credentials: 'include'
|
||||
credentials: "include"
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return (await res.json()).token;
|
||||
}
|
||||
console.log('Getting a new token failed');
|
||||
console.log("Getting a new token failed");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -12,10 +12,10 @@ interface Props {
|
||||
* @param {string} obj.code - code that a user received to the abovementioned email
|
||||
* @returns
|
||||
*/
|
||||
const verifySignupInvite = ({ email, organizationId, code }: Props) => fetch('/api/v1/invite-org/verify', {
|
||||
method: 'POST',
|
||||
const verifySignupInvite = ({ email, organizationId, code }: Props) => fetch("/api/v1/invite-org/verify", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
email,
|
||||
|
||||
@@ -8,15 +8,15 @@ const getBackupEncryptedPrivateKey = ({
|
||||
verificationToken
|
||||
}: {
|
||||
verificationToken: string;
|
||||
}) => fetch('/api/v1/password/backup-private-key', {
|
||||
method: 'GET',
|
||||
}) => fetch("/api/v1/password/backup-private-key", {
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${ verificationToken}`
|
||||
}
|
||||
}).then(async (res) => {
|
||||
if (res?.status !== 200) {
|
||||
console.log('Failed to get the backup key');
|
||||
console.log("Failed to get the backup key");
|
||||
}
|
||||
return (await res?.json())?.backupPrivateKey;
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const publicKeyInfisical = () => fetch('/api/v1/key/publicKey/infisical', {
|
||||
method: 'GET',
|
||||
const publicKeyInfisical = () => fetch("/api/v1/key/publicKey/infisical", {
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -31,10 +31,10 @@ const resetPasswordOnAccountRecovery = ({
|
||||
salt,
|
||||
verifier,
|
||||
verificationToken,
|
||||
}: Props) => fetch('/api/v1/password/password-reset', {
|
||||
method: 'POST',
|
||||
}: Props) => fetch("/api/v1/password/password-reset", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${verificationToken}`
|
||||
},
|
||||
body: JSON.stringify({
|
||||
@@ -49,7 +49,7 @@ const resetPasswordOnAccountRecovery = ({
|
||||
})
|
||||
}).then(async (res) => {
|
||||
if (res?.status !== 200) {
|
||||
console.log('Failed to get the backup key');
|
||||
console.log("Failed to get the backup key");
|
||||
}
|
||||
return res;
|
||||
});
|
||||
|
||||
@@ -14,7 +14,7 @@ const verifyMfaToken = async ({
|
||||
email: string;
|
||||
mfaToken: string;
|
||||
}) => {
|
||||
const { data } = await apiRequest.post('/api/v2/auth/mfa/verify', {
|
||||
const { data } = await apiRequest.post("/api/v2/auth/mfa/verify", {
|
||||
email,
|
||||
mfaToken
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
interface Props {
|
||||
workspaceId: string;
|
||||
@@ -12,15 +12,15 @@ interface Props {
|
||||
*/
|
||||
const getBot = async ({ workspaceId }: Props) =>
|
||||
SecurityClient.fetchCall(`/api/v1/bot/${workspaceId}`, {
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}).then(async (res) => {
|
||||
if (res && res.status === 200) {
|
||||
return (await res.json()).bot;
|
||||
}
|
||||
console.log('Failed to get bot for project');
|
||||
console.log("Failed to get bot for project");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
interface BotKey {
|
||||
encryptedKey: string;
|
||||
@@ -23,9 +23,9 @@ interface Props {
|
||||
*/
|
||||
const setBotActiveStatus = async ({ botId, isActive, botKey }: Props) =>
|
||||
SecurityClient.fetchCall(`/api/v1/bot/${botId}/active`, {
|
||||
method: 'PATCH',
|
||||
method: "PATCH",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
isActive,
|
||||
@@ -35,7 +35,7 @@ const setBotActiveStatus = async ({ botId, isActive, botKey }: Props) =>
|
||||
if (res && res.status === 200) {
|
||||
return res.json();
|
||||
}
|
||||
console.log('Failed to get bot for project');
|
||||
console.log("Failed to get bot for project");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
type NewEnvironmentInfo = {
|
||||
environmentSlug: string;
|
||||
@@ -12,16 +12,16 @@ type NewEnvironmentInfo = {
|
||||
*/
|
||||
const createEnvironment = (workspaceId: string, newEnv: NewEnvironmentInfo) =>
|
||||
SecurityClient.fetchCall(`/api/v2/workspace/${workspaceId}/environments`, {
|
||||
method: 'POST',
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify(newEnv)
|
||||
}).then(async (res) => {
|
||||
if (res && res.status === 200) {
|
||||
return res;
|
||||
}
|
||||
console.log('Failed to create environment');
|
||||
console.log("Failed to create environment");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
/**
|
||||
* This route deletes a specified env.
|
||||
* @param {*} workspaceId
|
||||
@@ -6,16 +6,16 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
*/
|
||||
const deleteEnvironment = (workspaceId: string, environmentSlug: string) =>
|
||||
SecurityClient.fetchCall(`/api/v2/workspace/${workspaceId}/environments`, {
|
||||
method: 'DELETE',
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({ environmentSlug })
|
||||
}).then(async (res) => {
|
||||
if (res && res.status === 200) {
|
||||
return res;
|
||||
}
|
||||
console.log('Failed to delete environment');
|
||||
console.log("Failed to delete environment");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
type EnvironmentInfo = {
|
||||
oldEnvironmentSlug: string;
|
||||
@@ -13,16 +13,16 @@ type EnvironmentInfo = {
|
||||
*/
|
||||
const updateEnvironment = (workspaceId: string, env: EnvironmentInfo) =>
|
||||
SecurityClient.fetchCall(`/api/v2/workspace/${workspaceId}/environments`, {
|
||||
method: 'PUT',
|
||||
method: "PUT",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify(env)
|
||||
}).then(async (res) => {
|
||||
if (res && res.status === 200) {
|
||||
return res;
|
||||
}
|
||||
console.log('Failed to update environment');
|
||||
console.log("Failed to update environment");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
interface EncryptedSecretProps {
|
||||
id: string;
|
||||
@@ -13,7 +13,7 @@ interface EncryptedSecretProps {
|
||||
secretValueCiphertext: string;
|
||||
secretValueIV: string;
|
||||
secretValueTag: string;
|
||||
type: 'personal' | 'shared';
|
||||
type: "personal" | "shared";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -33,10 +33,10 @@ const addSecrets = async ({
|
||||
env: string;
|
||||
workspaceId: string;
|
||||
}) =>
|
||||
SecurityClient.fetchCall('/api/v2/secrets', {
|
||||
method: 'POST',
|
||||
SecurityClient.fetchCall("/api/v2/secrets", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
environment: env,
|
||||
@@ -47,7 +47,7 @@ const addSecrets = async ({
|
||||
if (res && res.status === 200) {
|
||||
return res.json();
|
||||
}
|
||||
console.log('Failed to add certain project secrets');
|
||||
console.log("Failed to add certain project secrets");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
/**
|
||||
* This function deletes certain secrets from a certain project
|
||||
@@ -6,10 +6,10 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
* @returns
|
||||
*/
|
||||
const deleteSecrets = async ({ secretIds }: { secretIds: string[] }) =>
|
||||
SecurityClient.fetchCall('/api/v2/secrets', {
|
||||
method: 'DELETE',
|
||||
SecurityClient.fetchCall("/api/v2/secrets", {
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
secretIds
|
||||
@@ -18,7 +18,7 @@ const deleteSecrets = async ({ secretIds }: { secretIds: string[] }) =>
|
||||
if (res && res.status === 200) {
|
||||
return res.json();
|
||||
}
|
||||
console.log('Failed to delete certain project secrets');
|
||||
console.log("Failed to delete certain project secrets");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
/**
|
||||
* This function fetches the encrypted secrets for a certain project
|
||||
@@ -13,16 +13,16 @@ const getSecrets = async (workspaceId: string, env: string) =>
|
||||
workspaceId
|
||||
})}`,
|
||||
{
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}
|
||||
).then(async (res) => {
|
||||
if (res && res.status === 200) {
|
||||
return (await res.json()).secrets;
|
||||
}
|
||||
console.log('Failed to get project secrets');
|
||||
console.log("Failed to get project secrets");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
interface EncryptedSecretProps {
|
||||
id: string;
|
||||
@@ -13,7 +13,7 @@ interface EncryptedSecretProps {
|
||||
secretValueCiphertext: string;
|
||||
secretValueIV: string;
|
||||
secretValueTag: string;
|
||||
type: 'personal' | 'shared';
|
||||
type: "personal" | "shared";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -23,10 +23,10 @@ interface EncryptedSecretProps {
|
||||
* @returns
|
||||
*/
|
||||
const updateSecrets = async ({ secrets }: { secrets: EncryptedSecretProps[] }) =>
|
||||
SecurityClient.fetchCall('/api/v2/secrets', {
|
||||
method: 'PATCH',
|
||||
SecurityClient.fetchCall("/api/v2/secrets", {
|
||||
method: "PATCH",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
secrets
|
||||
@@ -35,7 +35,7 @@ const updateSecrets = async ({ secrets }: { secrets: EncryptedSecretProps[] }) =
|
||||
if (res && res.status === 200) {
|
||||
return res.json();
|
||||
}
|
||||
console.log('Failed to update certain project secrets');
|
||||
console.log("Failed to update certain project secrets");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
interface Props {
|
||||
workspaceId: string;
|
||||
@@ -18,21 +18,21 @@ interface Props {
|
||||
*/
|
||||
const uploadSecrets = async ({ workspaceId, secrets, keys, environment }: Props) =>
|
||||
SecurityClient.fetchCall(`/api/v2/workspace/${workspaceId}/secrets`, {
|
||||
method: 'POST',
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
secrets,
|
||||
keys,
|
||||
environment,
|
||||
channel: 'web'
|
||||
channel: "web"
|
||||
})
|
||||
}).then(async (res) => {
|
||||
if (res && res.status === 200) {
|
||||
return res;
|
||||
}
|
||||
console.log('Failed to push secrets');
|
||||
console.log("Failed to push secrets");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ const batchSecrets = async ({
|
||||
environment: string;
|
||||
requests: RequestType[];
|
||||
}) => {
|
||||
const { data } = await apiRequest.post('/api/v2/secrets/batch', {
|
||||
const { data } = await apiRequest.post("/api/v2/secrets/batch", {
|
||||
workspaceId,
|
||||
environment,
|
||||
requests
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
interface Props {
|
||||
integrationId: string;
|
||||
@@ -18,9 +18,9 @@ interface Props {
|
||||
|
||||
const changeHerokuConfigVars = ({ integrationId, key, secrets }: Props) =>
|
||||
SecurityClient.fetchCall(`/api/v1/integration/${integrationId}/sync`, {
|
||||
method: 'POST',
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
key,
|
||||
@@ -30,7 +30,7 @@ const changeHerokuConfigVars = ({ integrationId, key, secrets }: Props) =>
|
||||
if (res && res.status === 200) {
|
||||
return res;
|
||||
}
|
||||
console.log('Failed to sync secrets to Heroku');
|
||||
console.log("Failed to sync secrets to Heroku");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
interface Props {
|
||||
integrationId: string;
|
||||
@@ -11,9 +11,9 @@ interface Props {
|
||||
*/
|
||||
const deleteIntegration = ({ integrationId }: Props) =>
|
||||
SecurityClient.fetchCall(`/api/v1/integration/${integrationId}`, {
|
||||
method: 'DELETE',
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}).then(async (res) => {
|
||||
if (res && res.status === 200) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
interface Props {
|
||||
integrationAuthId: string;
|
||||
@@ -11,15 +11,15 @@ interface Props {
|
||||
*/
|
||||
const deleteIntegrationAuth = ({ integrationAuthId }: Props) =>
|
||||
SecurityClient.fetchCall(`/api/v1/integration-auth/${integrationAuthId}`, {
|
||||
method: 'DELETE',
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}).then(async (res) => {
|
||||
if (res && res.status === 200) {
|
||||
return (await res.json()).integrationAuth;
|
||||
}
|
||||
console.log('Failed to delete an integration authorization');
|
||||
console.log("Failed to delete an integration authorization");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
interface Props {
|
||||
integrationAuthId: string;
|
||||
@@ -6,15 +6,15 @@ interface Props {
|
||||
|
||||
const getIntegrationApps = ({ integrationAuthId }: Props) =>
|
||||
SecurityClient.fetchCall(`/api/v1/integration-auth/${integrationAuthId}/apps`, {
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}).then(async (res) => {
|
||||
if (res && res.status === 200) {
|
||||
return (await res.json()).apps;
|
||||
}
|
||||
console.log('Failed to get available apps for an integration');
|
||||
console.log("Failed to get available apps for an integration");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
const getIntegrationOptions = () =>
|
||||
SecurityClient.fetchCall('/api/v1/integration-auth/integration-options', {
|
||||
method: 'GET',
|
||||
SecurityClient.fetchCall("/api/v1/integration-auth/integration-options", {
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}).then(async (res) => {
|
||||
if (res && res.status === 200) {
|
||||
return (await res.json()).integrationOptions;
|
||||
}
|
||||
console.log('Failed to get (cloud) integration options');
|
||||
console.log("Failed to get (cloud) integration options");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
interface Props {
|
||||
integrationId: string;
|
||||
@@ -13,9 +13,9 @@ interface Props {
|
||||
*/
|
||||
const startIntegration = ({ integrationId, appName, environment }: Props) =>
|
||||
SecurityClient.fetchCall(`/api/v1/integration/${integrationId}`, {
|
||||
method: 'PATCH',
|
||||
method: "PATCH",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
update: {
|
||||
@@ -28,7 +28,7 @@ const startIntegration = ({ integrationId, appName, environment }: Props) =>
|
||||
if (res && res.status === 200) {
|
||||
return res;
|
||||
}
|
||||
console.log('Failed to start an integration');
|
||||
console.log("Failed to start an integration");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
interface Props {
|
||||
workspaceId: string;
|
||||
@@ -14,10 +14,10 @@ interface Props {
|
||||
* @returns
|
||||
*/
|
||||
const AuthorizeIntegration = ({ workspaceId, code, integration }: Props) =>
|
||||
SecurityClient.fetchCall('/api/v1/integration-auth/oauth-token', {
|
||||
method: 'POST',
|
||||
SecurityClient.fetchCall("/api/v1/integration-auth/oauth-token", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
workspaceId,
|
||||
@@ -28,7 +28,7 @@ const AuthorizeIntegration = ({ workspaceId, code, integration }: Props) =>
|
||||
if (res && res.status === 200) {
|
||||
return (await res.json()).integrationAuth;
|
||||
}
|
||||
console.log('Failed to authorize the integration');
|
||||
console.log("Failed to authorize the integration");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
interface Props {
|
||||
integrationAuthId: string;
|
||||
@@ -36,10 +36,10 @@ const createIntegration = ({
|
||||
region,
|
||||
secretPath
|
||||
}: Props) =>
|
||||
SecurityClient.fetchCall('/api/v1/integration', {
|
||||
method: 'POST',
|
||||
SecurityClient.fetchCall("/api/v1/integration", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
integrationAuthId,
|
||||
@@ -60,7 +60,7 @@ const createIntegration = ({
|
||||
if (res && res.status === 200) {
|
||||
return (await res.json()).integration;
|
||||
}
|
||||
console.log('Failed to create integration');
|
||||
console.log("Failed to create integration");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
interface Props {
|
||||
workspaceId: string;
|
||||
@@ -11,15 +11,15 @@ interface Props {
|
||||
*/
|
||||
const getWorkspaceAuthorizations = ({ workspaceId }: Props) =>
|
||||
SecurityClient.fetchCall(`/api/v1/workspace/${workspaceId}/authorizations`, {
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}).then(async (res) => {
|
||||
if (res && res.status === 200) {
|
||||
return (await res.json()).authorizations;
|
||||
}
|
||||
console.log('Failed to get project authorizations');
|
||||
console.log("Failed to get project authorizations");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
interface Props {
|
||||
workspaceId: string;
|
||||
@@ -11,15 +11,15 @@ interface Props {
|
||||
*/
|
||||
const getWorkspaceIntegrations = ({ workspaceId }: Props) =>
|
||||
SecurityClient.fetchCall(`/api/v1/workspace/${workspaceId}/integrations`, {
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}).then(async (res) => {
|
||||
if (res && res.status === 200) {
|
||||
return (await res.json()).integrations;
|
||||
}
|
||||
console.log('Failed to get the project integrations');
|
||||
console.log("Failed to get the project integrations");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
interface Props {
|
||||
workspaceId: string | null;
|
||||
@@ -29,10 +29,10 @@ const saveIntegrationAccessToken = ({
|
||||
url,
|
||||
namespace
|
||||
}: Props) =>
|
||||
SecurityClient.fetchCall(`/api/v1/integration-auth/access-token`, {
|
||||
method: 'POST',
|
||||
SecurityClient.fetchCall("/api/v1/integration-auth/access-token", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
workspaceId,
|
||||
@@ -46,7 +46,7 @@ const saveIntegrationAccessToken = ({
|
||||
if (res && res.status === 200) {
|
||||
return (await res.json()).integrationAuth;
|
||||
}
|
||||
console.log('Failed to save integration access details');
|
||||
console.log("Failed to save integration access details");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
/**
|
||||
* This route starts the integration after teh default one if gonna set up.
|
||||
@@ -32,9 +32,9 @@ const updateIntegration = ({
|
||||
owner: string | null;
|
||||
}) =>
|
||||
SecurityClient.fetchCall(`/api/v1/integration/${integrationId}`, {
|
||||
method: 'PATCH',
|
||||
method: "PATCH",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
app,
|
||||
@@ -48,7 +48,7 @@ const updateIntegration = ({
|
||||
if (res && res.status === 200) {
|
||||
return (await res.json()).integration;
|
||||
}
|
||||
console.log('Failed to start an integration');
|
||||
console.log("Failed to start an integration");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
/**
|
||||
* This route lets us get info about a certain org
|
||||
@@ -7,15 +7,15 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
*/
|
||||
const getOrganization = ({ orgId }: { orgId: string }) =>
|
||||
SecurityClient.fetchCall(`/api/v1/organization/${orgId}`, {
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}).then(async (res) => {
|
||||
if (res?.status === 200) {
|
||||
return (await res.json()).organization;
|
||||
}
|
||||
console.log('Failed to get org info');
|
||||
console.log("Failed to get org info");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
/**
|
||||
* This route lets us get all the project memebrships of users in an org.
|
||||
@@ -9,15 +9,15 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
|
||||
const getOrganizationProjectMemberships = (req: { orgId: string }) =>
|
||||
SecurityClient.fetchCall(`/api/v1/organization/${req.orgId}/workspace-memberships`, {
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}).then(async (res) => {
|
||||
if (res && res.status === 200) {
|
||||
return res.json();
|
||||
}
|
||||
console.log('Failed to get project memberships for users in an org');
|
||||
console.log("Failed to get project memberships for users in an org");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
/**
|
||||
* This route lets us get all the users in an org.
|
||||
@@ -10,15 +10,15 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
// TODO: this file is not used anywhere
|
||||
const getOrganizationProjects = (req: { orgId: string }) =>
|
||||
SecurityClient.fetchCall(`/api/organization/${req.orgId}/workspaces`, {
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}).then(async (res) => {
|
||||
if (res && res.status === 200) {
|
||||
return (await res.json()).workspaces;
|
||||
}
|
||||
console.log('Failed to get projects for an org');
|
||||
console.log("Failed to get projects for an org");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
/**
|
||||
* This route lets us get the current subscription of an org.
|
||||
@@ -8,15 +8,15 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
*/
|
||||
const getOrganizationSubscriptions = (req: { orgId: string }) =>
|
||||
SecurityClient.fetchCall(`/api/v1/organization/${req.orgId}/subscriptions`, {
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}).then(async (res) => {
|
||||
if (res && res.status === 200) {
|
||||
return (await res.json()).subscriptions;
|
||||
}
|
||||
console.log('Failed to get org subscriptions');
|
||||
console.log("Failed to get org subscriptions");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
/**
|
||||
* This route lets us get all the projects of a certain user in an org.
|
||||
@@ -8,15 +8,15 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
*/
|
||||
const getOrganizationUserProjects = (req: { orgId: string }) =>
|
||||
SecurityClient.fetchCall(`/api/v1/organization/${req.orgId}/my-workspaces`, {
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}).then(async (res) => {
|
||||
if (res && res.status === 200) {
|
||||
return (await res.json()).workspaces;
|
||||
}
|
||||
console.log('Failed to get projects of a user in an org');
|
||||
console.log("Failed to get projects of a user in an org");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
export interface IMembershipOrg {
|
||||
_id: string;
|
||||
@@ -11,8 +11,8 @@ export interface IMembershipOrg {
|
||||
};
|
||||
inviteEmail: string;
|
||||
organization: string;
|
||||
role: 'owner' | 'admin' | 'member';
|
||||
status: 'invited' | 'accepted';
|
||||
role: "owner" | "admin" | "member";
|
||||
status: "invited" | "accepted";
|
||||
deniedPermissions: any[];
|
||||
}
|
||||
/**
|
||||
@@ -23,15 +23,15 @@ export interface IMembershipOrg {
|
||||
*/
|
||||
const getOrganizationUsers = ({ orgId }: { orgId: string }): Promise<IMembershipOrg[]> =>
|
||||
SecurityClient.fetchCall(`/api/v1/organization/${orgId}/users`, {
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}).then(async (res) => {
|
||||
if (res?.status === 200) {
|
||||
return (await res.json()).users;
|
||||
}
|
||||
console.log('Failed to get org users');
|
||||
console.log("Failed to get org users");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
/**
|
||||
* This route redirects the user to the right stripe billing page.
|
||||
@@ -8,16 +8,16 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
*/
|
||||
const StripeRedirect = ({ orgId }: { orgId: string }) =>
|
||||
SecurityClient.fetchCall(`/api/v1/organization/${orgId}/customer-portal-session`, {
|
||||
method: 'POST',
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}).then(async (res) => {
|
||||
if (res && res.status === 200) {
|
||||
window.location.href = (await res.json()).url;
|
||||
return;
|
||||
}
|
||||
console.log('Failed to redirect to Stripe');
|
||||
console.log("Failed to redirect to Stripe");
|
||||
});
|
||||
|
||||
export default StripeRedirect;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
/**
|
||||
* This route add an incident contact email to a certain organization
|
||||
@@ -7,9 +7,9 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
*/
|
||||
const addIncidentContact = (organizationId: string, email: string) =>
|
||||
SecurityClient.fetchCall(`/api/v1/organization/${organizationId}/incidentContactOrg`, {
|
||||
method: 'POST',
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
email
|
||||
@@ -18,7 +18,7 @@ const addIncidentContact = (organizationId: string, email: string) =>
|
||||
if (res && res.status === 200) {
|
||||
return res;
|
||||
}
|
||||
console.log('Failed to add an incident contact');
|
||||
console.log("Failed to add an incident contact");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
/**
|
||||
* This function sends an email invite to a user to join an org
|
||||
@@ -7,10 +7,10 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
* @returns
|
||||
*/
|
||||
const addUserToOrg = (email: string, orgId: string) =>
|
||||
SecurityClient.fetchCall('/api/v1/invite-org/signup', {
|
||||
method: 'POST',
|
||||
SecurityClient.fetchCall("/api/v1/invite-org/signup", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
inviteeEmail: email,
|
||||
@@ -20,7 +20,7 @@ const addUserToOrg = (email: string, orgId: string) =>
|
||||
if (res && res.status === 200) {
|
||||
return res;
|
||||
}
|
||||
console.log('Failed to add a user to an org');
|
||||
console.log("Failed to add a user to an org");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
/**
|
||||
* This function change the access of a user in a certain organization
|
||||
@@ -9,9 +9,9 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
*/
|
||||
const changeUserRoleInOrganization = (organizationId: string, membershipId: string, role: string) =>
|
||||
SecurityClient.fetchCall(`/api/v2/organizations/${organizationId}/memberships/${membershipId}`, {
|
||||
method: 'PATCH',
|
||||
method: "PATCH",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
role
|
||||
@@ -20,7 +20,7 @@ const changeUserRoleInOrganization = (organizationId: string, membershipId: stri
|
||||
if (res && res.status === 200) {
|
||||
return res;
|
||||
}
|
||||
console.log('Failed to change the user role in an org');
|
||||
console.log("Failed to change the user role in an org");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
/**
|
||||
* This route deletes an incident Contact from a certain organization
|
||||
@@ -7,9 +7,9 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
*/
|
||||
const deleteIncidentContact = (organizationId: string, email: string) =>
|
||||
SecurityClient.fetchCall(`/api/v1/organization/${organizationId}/incidentContactOrg`, {
|
||||
method: 'DELETE',
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
email
|
||||
@@ -18,7 +18,7 @@ const deleteIncidentContact = (organizationId: string, email: string) =>
|
||||
if (res && res.status === 200) {
|
||||
return res;
|
||||
}
|
||||
console.log('Failed to delete an incident contact');
|
||||
console.log("Failed to delete an incident contact");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
/**
|
||||
* This function removes a certain member from a certain organization
|
||||
@@ -7,15 +7,15 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
*/
|
||||
const deleteUserFromOrganization = (membershipId: string) =>
|
||||
SecurityClient.fetchCall(`/api/v1/membership-org/${membershipId}`, {
|
||||
method: 'DELETE',
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}).then(async (res) => {
|
||||
if (res && res.status === 200) {
|
||||
return res;
|
||||
}
|
||||
console.log('Failed to delete a user from an org');
|
||||
console.log("Failed to delete a user from an org");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
export interface IIncidentContactOrg {
|
||||
_id: string;
|
||||
@@ -12,15 +12,15 @@ export interface IIncidentContactOrg {
|
||||
*/
|
||||
const getIncidentContacts = (organizationId: string): Promise<IIncidentContactOrg[]> =>
|
||||
SecurityClient.fetchCall(`/api/v1/organization/${organizationId}/incidentContactOrg`, {
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}).then(async (res) => {
|
||||
if (res && res.status === 200) {
|
||||
return (await res.json()).incidentContactsOrg;
|
||||
}
|
||||
console.log('Failed to get incident contacts');
|
||||
console.log("Failed to get incident contacts");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
/**
|
||||
* This route lets us get the all the orgs of a certain user.
|
||||
* @returns
|
||||
*/
|
||||
const getOrganizations = () =>
|
||||
SecurityClient.fetchCall('/api/v1/organization', {
|
||||
method: 'GET',
|
||||
SecurityClient.fetchCall("/api/v1/organization", {
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}).then(async (res) => {
|
||||
if (res?.status === 200) {
|
||||
return (await res.json()).organizations;
|
||||
}
|
||||
console.log('Failed to get orgs of a user');
|
||||
console.log("Failed to get orgs of a user");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
/**
|
||||
* This route lets us rename a certain org.
|
||||
@@ -8,9 +8,9 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
*/
|
||||
const renameOrg = (orgId: string, newOrgName: string) =>
|
||||
SecurityClient.fetchCall(`/api/v1/organization/${orgId}/name`, {
|
||||
method: 'PATCH',
|
||||
method: "PATCH",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
name: newOrgName
|
||||
@@ -19,7 +19,7 @@ const renameOrg = (orgId: string, newOrgName: string) =>
|
||||
if (res && res.status === 200) {
|
||||
return res;
|
||||
}
|
||||
console.log('Failed to rename an organization');
|
||||
console.log("Failed to rename an organization");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
interface Props {
|
||||
name: string;
|
||||
@@ -31,10 +31,10 @@ const addServiceToken = ({
|
||||
iv,
|
||||
tag
|
||||
}: Props) =>
|
||||
SecurityClient.fetchCall('/api/v2/service-token/', {
|
||||
method: 'POST',
|
||||
SecurityClient.fetchCall("/api/v2/service-token/", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
name,
|
||||
@@ -49,7 +49,7 @@ const addServiceToken = ({
|
||||
if (res && res.status === 200) {
|
||||
return res.json();
|
||||
}
|
||||
console.log('Failed to add service tokens');
|
||||
console.log("Failed to add service tokens");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
interface Props {
|
||||
serviceTokenId: string;
|
||||
@@ -12,15 +12,15 @@ interface Props {
|
||||
*/
|
||||
const deleteServiceToken = ({ serviceTokenId }: Props) =>
|
||||
SecurityClient.fetchCall(`/api/v2/service-token/${serviceTokenId}`, {
|
||||
method: 'DELETE',
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}).then(async (res) => {
|
||||
if (res && res.status === 200) {
|
||||
return res.json();
|
||||
}
|
||||
console.log('Failed to delete a service token');
|
||||
console.log("Failed to delete a service token");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
/**
|
||||
* This route gets service tokens for a specific user in a project
|
||||
@@ -7,15 +7,15 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
*/
|
||||
const getServiceTokens = ({ workspaceId }: { workspaceId: string }) =>
|
||||
SecurityClient.fetchCall(`/api/v2/workspace/${workspaceId}/service-token-data`, {
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}).then(async (res) => {
|
||||
if (res && res.status === 200) {
|
||||
return (await res.json()).serviceTokenData;
|
||||
}
|
||||
console.log('Failed to get service tokens');
|
||||
console.log("Failed to get service tokens");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
/**
|
||||
* This route gets the information about a specific user.
|
||||
*/
|
||||
const getUser = () =>
|
||||
SecurityClient.fetchCall('/api/v1/user', {
|
||||
method: 'GET',
|
||||
SecurityClient.fetchCall("/api/v1/user", {
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}).then(async (res) => {
|
||||
if (res?.status === 200) {
|
||||
return (await res.json()).user;
|
||||
}
|
||||
console.log('Failed to get user info');
|
||||
console.log("Failed to get user info");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
interface Props {
|
||||
isMfaEnabled: boolean;
|
||||
@@ -13,10 +13,10 @@ interface Props {
|
||||
const updateMyMfaEnabled = async ({
|
||||
isMfaEnabled
|
||||
}: Props) =>
|
||||
SecurityClient.fetchCall(`/api/v2/users/me/mfa`, {
|
||||
method: 'PATCH',
|
||||
SecurityClient.fetchCall("/api/v2/users/me/mfa", {
|
||||
method: "PATCH",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
isMfaEnabled,
|
||||
@@ -25,7 +25,7 @@ const updateMyMfaEnabled = async ({
|
||||
if (res && res.status === 200) {
|
||||
return (await res.json()).user;
|
||||
}
|
||||
console.log('Failed to update MFA status');
|
||||
console.log("Failed to update MFA status");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
/**
|
||||
* This route registers a certain action for a user
|
||||
@@ -8,21 +8,21 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
*/
|
||||
const checkUserAction = ({ action }: { action: string }) =>
|
||||
SecurityClient.fetchCall(
|
||||
`/api/v1/user-action` +
|
||||
"/api/v1/user-action" +
|
||||
`?${new URLSearchParams({
|
||||
action
|
||||
})}`,
|
||||
{
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}
|
||||
).then(async (res) => {
|
||||
if (res && res.status === 200) {
|
||||
return (await res.json()).userAction;
|
||||
}
|
||||
console.log('Failed to check a user action');
|
||||
console.log("Failed to check a user action");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
/**
|
||||
* This route registers a certain action for a user
|
||||
@@ -6,10 +6,10 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
* @returns
|
||||
*/
|
||||
const registerUserAction = ({ action }: { action: string }) =>
|
||||
SecurityClient.fetchCall('/api/v1/user-action', {
|
||||
method: 'POST',
|
||||
SecurityClient.fetchCall("/api/v1/user-action", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
action
|
||||
@@ -18,7 +18,7 @@ const registerUserAction = ({ action }: { action: string }) =>
|
||||
if (res && res.status === 200) {
|
||||
return res;
|
||||
}
|
||||
console.log('Failed to register a user action');
|
||||
console.log("Failed to register a user action");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
/**
|
||||
* This function adds a user to a project
|
||||
@@ -8,9 +8,9 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
*/
|
||||
const addUserToWorkspace = (email: string, workspaceId: string) =>
|
||||
SecurityClient.fetchCall(`/api/v1/workspace/${workspaceId}/invite-signup`, {
|
||||
method: 'POST',
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
email
|
||||
@@ -19,7 +19,7 @@ const addUserToWorkspace = (email: string, workspaceId: string) =>
|
||||
if (res && res.status === 200) {
|
||||
return res.json();
|
||||
}
|
||||
console.log('Failed to add a user to project');
|
||||
console.log("Failed to add a user to project");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
/**
|
||||
* This function change the access of a user in a certain workspace
|
||||
@@ -8,9 +8,9 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
*/
|
||||
const changeUserRoleInWorkspace = (membershipId: string, role: string) =>
|
||||
SecurityClient.fetchCall(`/api/v1/membership/${membershipId}/change-role`, {
|
||||
method: 'POST',
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
role
|
||||
@@ -19,7 +19,7 @@ const changeUserRoleInWorkspace = (membershipId: string, role: string) =>
|
||||
if (res && res.status === 200) {
|
||||
return res;
|
||||
}
|
||||
console.log('Failed to change the user role in a project');
|
||||
console.log("Failed to change the user role in a project");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
/**
|
||||
* This route creates a new workspace for a user within a certain organization.
|
||||
@@ -13,10 +13,10 @@ const createWorkspace = ({
|
||||
workspaceName: string;
|
||||
organizationId: string;
|
||||
}) =>
|
||||
SecurityClient.fetchCall('/api/v1/workspace', {
|
||||
method: 'POST',
|
||||
SecurityClient.fetchCall("/api/v1/workspace", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
workspaceName,
|
||||
@@ -26,7 +26,7 @@ const createWorkspace = ({
|
||||
if (res?.status === 200) {
|
||||
return (await res.json()).workspace;
|
||||
}
|
||||
console.log('Failed to create a project');
|
||||
console.log("Failed to create a project");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
/**
|
||||
* This function removes a certain member from a certain workspace
|
||||
@@ -7,15 +7,15 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
*/
|
||||
const deleteUserFromWorkspace = (membershipId: string) =>
|
||||
SecurityClient.fetchCall(`/api/v1/membership/${membershipId}`, {
|
||||
method: 'DELETE',
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}).then(async (res) => {
|
||||
if (res && res.status === 200) {
|
||||
return res;
|
||||
}
|
||||
console.log('Failed to delete a user from a project');
|
||||
console.log("Failed to delete a user from a project");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
/**
|
||||
* This route deletes a specified workspace.
|
||||
@@ -7,15 +7,15 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
*/
|
||||
const deleteWorkspace = (workspaceId: string) =>
|
||||
SecurityClient.fetchCall(`/api/v1/workspace/${workspaceId}`, {
|
||||
method: 'DELETE',
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}).then(async (res) => {
|
||||
if (res && res.status === 200) {
|
||||
return res;
|
||||
}
|
||||
console.log('Failed to delete a project');
|
||||
console.log("Failed to delete a project");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
interface Workspace {
|
||||
__v: number;
|
||||
@@ -14,9 +14,9 @@ interface Workspace {
|
||||
*/
|
||||
const getAWorkspace = (workspaceID: string) =>
|
||||
SecurityClient.fetchCall(`/api/v1/workspace/${workspaceID}`, {
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}).then(async (res) => {
|
||||
if (res?.status === 200) {
|
||||
@@ -24,7 +24,7 @@ const getAWorkspace = (workspaceID: string) =>
|
||||
return data.workspace;
|
||||
}
|
||||
|
||||
throw new Error('Failed to get workspace');
|
||||
throw new Error("Failed to get workspace");
|
||||
});
|
||||
|
||||
export default getAWorkspace;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { apiRequest } from '@app/config/request';
|
||||
import { apiRequest } from "@app/config/request";
|
||||
|
||||
/**
|
||||
* Get the latest key pairs from a certain workspace
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
/**
|
||||
* This route lets us get the information of a certain project.
|
||||
@@ -7,15 +7,15 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
*/
|
||||
const getProjectInfo = ({ projectId }: { projectId: string }) =>
|
||||
SecurityClient.fetchCall(`/api/v1/workspace/${projectId}`, {
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}).then(async (res) => {
|
||||
if (res?.status === 200) {
|
||||
return (await res.json()).workspace;
|
||||
}
|
||||
console.log('Failed to get project info');
|
||||
console.log("Failed to get project info");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
/**
|
||||
* This route lets us get the environments that a certain user has acess to in a certain project
|
||||
@@ -7,15 +7,15 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
*/
|
||||
const getWorkspaceEnvironments = ({ workspaceId }: { workspaceId: string }) =>
|
||||
SecurityClient.fetchCall(`/api/v2/workspace/${workspaceId}/environments`, {
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}).then(async (res) => {
|
||||
if (res?.status === 200) {
|
||||
return (await res.json()).accessibleEnvironments;
|
||||
}
|
||||
console.log('Failed to get accessible environments');
|
||||
console.log("Failed to get accessible environments");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
/**
|
||||
* This route lets us get the public keys of everyone in your workspace.
|
||||
@@ -7,15 +7,15 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
*/
|
||||
const getWorkspaceKeys = ({ workspaceId }: { workspaceId: string }) =>
|
||||
SecurityClient.fetchCall(`/api/v1/workspace/${workspaceId}/keys`, {
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}).then(async (res) => {
|
||||
if (res?.status === 200) {
|
||||
return (await res.json()).publicKeys;
|
||||
}
|
||||
console.log('Failed to get the public keys of everyone in the workspace');
|
||||
console.log("Failed to get the public keys of everyone in the workspace");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
/**
|
||||
* This route lets us get the tags for a certain project
|
||||
@@ -7,15 +7,15 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
*/
|
||||
const getWorkspaceTags = ({ workspaceId }: { workspaceId: string }) =>
|
||||
SecurityClient.fetchCall(`/api/v2/workspace/${workspaceId}/tags`, {
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}).then(async (res) => {
|
||||
if (res?.status === 200) {
|
||||
return (await res.json()).workspaceTags;
|
||||
}
|
||||
console.log('Failed to get the tags available in a certain project');
|
||||
console.log("Failed to get the tags available in a certain project");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
/**
|
||||
* This route lets us get all the users in the workspace.
|
||||
@@ -7,15 +7,15 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
*/
|
||||
const getWorkspaceUsers = ({ workspaceId }: { workspaceId: string }) =>
|
||||
SecurityClient.fetchCall(`/api/v1/workspace/${workspaceId}/users`, {
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}).then(async (res) => {
|
||||
if (res?.status === 200) {
|
||||
return (await res.json()).users;
|
||||
}
|
||||
console.log('Failed to get Project Users');
|
||||
console.log("Failed to get Project Users");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
interface Workspace {
|
||||
__v: number;
|
||||
@@ -14,10 +14,10 @@ interface Workspace {
|
||||
* @returns
|
||||
*/
|
||||
const getWorkspaces = () =>
|
||||
SecurityClient.fetchCall('/api/v1/workspace', {
|
||||
method: 'GET',
|
||||
SecurityClient.fetchCall("/api/v1/workspace", {
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}).then(async (res) => {
|
||||
if (res?.status === 200) {
|
||||
@@ -25,7 +25,7 @@ const getWorkspaces = () =>
|
||||
return data.workspaces;
|
||||
}
|
||||
|
||||
throw new Error('Failed to get projects');
|
||||
throw new Error("Failed to get projects");
|
||||
});
|
||||
|
||||
export default getWorkspaces;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
/**
|
||||
* This route lets us rename a certain workspace.
|
||||
@@ -8,9 +8,9 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
*/
|
||||
const renameWorkspace = (workspaceId: string, newWorkspaceName: string) =>
|
||||
SecurityClient.fetchCall(`/api/v1/workspace/${workspaceId}/name`, {
|
||||
method: 'POST',
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
name: newWorkspaceName
|
||||
@@ -19,7 +19,7 @@ const renameWorkspace = (workspaceId: string, newWorkspaceName: string) =>
|
||||
if (res && res.status === 200) {
|
||||
return res;
|
||||
}
|
||||
console.log('Failed to rename a project');
|
||||
console.log("Failed to rename a project");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
|
||||
/**
|
||||
* This route uplods the keys in an encrypted format.
|
||||
@@ -10,9 +10,9 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
*/
|
||||
const uploadKeys = (workspaceId: string, userId: string, encryptedKey: string, nonce: string) =>
|
||||
SecurityClient.fetchCall(`/api/v1/key/${workspaceId}`, {
|
||||
method: 'POST',
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
key: {
|
||||
@@ -25,7 +25,7 @@ const uploadKeys = (workspaceId: string, userId: string, encryptedKey: string, n
|
||||
if (res && res.status === 200) {
|
||||
return res;
|
||||
}
|
||||
console.log('Failed to upload keys for a new user');
|
||||
console.log("Failed to upload keys for a new user");
|
||||
return undefined;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user