mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-16 10:18:16 +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";
|
||||
|
||||
/**
|
||||
* 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