Changed frontend to use the new secrets routes

This commit is contained in:
Vladyslav Matsiiako
2023-01-09 13:14:07 -08:00
parent b6189a90f4
commit 486aa139c2
23 changed files with 648 additions and 390 deletions
@@ -273,7 +273,7 @@ export const updateSecrets = async (req: Request, res: Response) => {
});
await Secret.bulkWrite(ops);
let newSecretsObj: { [key: string]: PatchSecret } = {};
const newSecretsObj: { [key: string]: PatchSecret } = {};
req.body.secrets.forEach((secret: PatchSecret) => {
newSecretsObj[secret.id] = secret;
});
@@ -323,7 +323,7 @@ export const updateSecrets = async (req: Request, res: Response) => {
// group secrets into workspaces so updated secrets can
// be logged and snapshotted separately for each workspace
let workspaceSecretObj: any = {};
const workspaceSecretObj: any = {};
req.secrets.forEach((s: any) => {
if (s.workspace.toString() in workspaceSecretObj) {
workspaceSecretObj[s.workspace.toString()].push(s);
@@ -399,7 +399,7 @@ export const deleteSecrets = async (req: Request, res: Response) => {
// group secrets into workspaces so deleted secrets can
// be logged and snapshotted separately for each workspace
let workspaceSecretObj: any = {};
const workspaceSecretObj: any = {};
req.secrets.forEach((s: any) => {
if (s.workspace.toString() in workspaceSecretObj) {
workspaceSecretObj[s.workspace.toString()].push(s);
@@ -445,7 +445,7 @@ export const deleteSecrets = async (req: Request, res: Response) => {
}
});
return res.status(400).send({
return res.status(200).send({
secrets: req.secrets
});
}