chore(frontend): fixed all eslint errors

This commit is contained in:
akhilmhdh
2023-01-17 21:06:14 +05:30
parent 9f82e2d836
commit cf7834bfc3
184 changed files with 6255 additions and 6117 deletions
+26 -20
View File
@@ -1,4 +1,4 @@
import SecurityClient from '~/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';
}
/**
@@ -24,25 +24,31 @@ interface EncryptedSecretProps {
* @param {string} obj.workspaceId - the project to which we are adding secrets
* @returns
*/
const addSecrets = async ({ secrets, env, workspaceId }: { secrets: EncryptedSecretProps[]; env: string; workspaceId: string; }) => {
return SecurityClient.fetchCall('/api/v2/secrets', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
environment: env,
workspaceId,
secrets
})
}
).then(async (res) => {
if (res && res.status == 200) {
return await res.json();
} else {
console.log('Failed to add certain project secrets');
const addSecrets = async ({
secrets,
env,
workspaceId
}: {
secrets: EncryptedSecretProps[];
env: string;
workspaceId: string;
}) =>
SecurityClient.fetchCall('/api/v2/secrets', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
environment: env,
workspaceId,
secrets
})
}).then(async (res) => {
if (res && res.status === 200) {
return res.json();
}
console.log('Failed to add certain project secrets');
return undefined;
});
};
export default addSecrets;
+15 -17
View File
@@ -1,27 +1,25 @@
import SecurityClient from '~/utilities/SecurityClient';
import SecurityClient from '@app/components/utilities/SecurityClient';
/**
* This function deletes certain secrets from a certain project
* @param {string[]} secretIds - the ids of secrets that we want to be deleted
* @returns
*/
const deleteSecrets = async ({ secretIds }: { secretIds: string[] }) => {
return SecurityClient.fetchCall('/api/v2/secrets', {
method: 'DELETE',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
secretIds
})
}
).then(async (res) => {
if (res && res.status == 200) {
return await res.json();
} else {
console.log('Failed to delete certain project secrets');
const deleteSecrets = async ({ secretIds }: { secretIds: string[] }) =>
SecurityClient.fetchCall('/api/v2/secrets', {
method: 'DELETE',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
secretIds
})
}).then(async (res) => {
if (res && res.status === 200) {
return res.json();
}
console.log('Failed to delete certain project secrets');
return undefined;
});
};
export default deleteSecrets;
+10 -12
View File
@@ -1,4 +1,4 @@
import SecurityClient from '~/utilities/SecurityClient';
import SecurityClient from '@app/components/utilities/SecurityClient';
/**
* This function fetches the encrypted secrets for a certain project
@@ -6,13 +6,12 @@ import SecurityClient from '~/utilities/SecurityClient';
* @param {string} env - environment of a project for which a user is trying ot get secrets
* @returns
*/
const getSecrets = async (workspaceId: string, env: string) => {
return SecurityClient.fetchCall(
'/api/v2/secrets?' +
new URLSearchParams({
environment: env,
workspaceId
}),
const getSecrets = async (workspaceId: string, env: string) =>
SecurityClient.fetchCall(
`/api/v2/secrets?${new URLSearchParams({
environment: env,
workspaceId
})}`,
{
method: 'GET',
headers: {
@@ -20,12 +19,11 @@ const getSecrets = async (workspaceId: string, env: string) => {
}
}
).then(async (res) => {
if (res && res.status == 200) {
if (res && res.status === 200) {
return (await res.json()).secrets;
} else {
console.log('Failed to get project secrets');
}
console.log('Failed to get project secrets');
return undefined;
});
};
export default getSecrets;
+16 -18
View File
@@ -1,4 +1,4 @@
import SecurityClient from '~/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';
}
/**
@@ -22,23 +22,21 @@ interface EncryptedSecretProps {
* @param {EncryptedSecretProps[]} obj.secrets - the ids of secrets that we want to update
* @returns
*/
const updateSecrets = async ({ secrets }: { secrets: EncryptedSecretProps[] }) => {
return SecurityClient.fetchCall('/api/v2/secrets', {
method: 'PATCH',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
secrets
})
}
).then(async (res) => {
if (res && res.status == 200) {
return await res.json();
} else {
console.log('Failed to update certain project secrets');
const updateSecrets = async ({ secrets }: { secrets: EncryptedSecretProps[] }) =>
SecurityClient.fetchCall('/api/v2/secrets', {
method: 'PATCH',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
secrets
})
}).then(async (res) => {
if (res && res.status === 200) {
return res.json();
}
console.log('Failed to update certain project secrets');
return undefined;
});
};
export default updateSecrets;
+6 -12
View File
@@ -1,4 +1,4 @@
import SecurityClient from '~/utilities/SecurityClient';
import SecurityClient from '@app/components/utilities/SecurityClient';
interface Props {
workspaceId: string;
@@ -16,13 +16,8 @@ interface Props {
* @param {string} obj.environment
* @returns
*/
const uploadSecrets = async ({
workspaceId,
secrets,
keys,
environment
}: Props) => {
return SecurityClient.fetchCall('/api/v2/workspace/' + workspaceId + '/secrets', {
const uploadSecrets = async ({ workspaceId, secrets, keys, environment }: Props) =>
SecurityClient.fetchCall(`/api/v2/workspace/${workspaceId}/secrets`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
@@ -34,12 +29,11 @@ const uploadSecrets = async ({
channel: 'web'
})
}).then(async (res) => {
if (res && res.status == 200) {
if (res && res.status === 200) {
return res;
} else {
console.log('Failed to push secrets');
}
console.log('Failed to push secrets');
return undefined;
});
};
export default uploadSecrets;