Clean up and weave crypto into service account permissions

This commit is contained in:
Tuan Dang
2023-03-29 18:07:15 +07:00
parent 729aacc154
commit 88c0a46de3
20 changed files with 360 additions and 240 deletions
@@ -1,22 +1,13 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import { apiRequest } from '@app/config/request';
/**
* Get the latest key pairs from a certain workspace
* @param {string} workspaceId
* @returns
*/
const getLatestFileKey = ({ workspaceId }: { workspaceId: string }) =>
SecurityClient.fetchCall(`/api/v1/key/${workspaceId}/latest`, {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
}).then(async (res) => {
if (res?.status === 200) {
return res.json();
}
console.log('Failed to get the latest key pairs for a certain project');
return undefined;
});
const getLatestFileKey = async ({ workspaceId }: { workspaceId: string }) => {
const { data } = await apiRequest.get(`/api/v1/key/${workspaceId}/latest`);
return data;
}
export default getLatestFileKey;
@@ -1,23 +1,17 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import Head from 'next/head';
import { useRouter } from 'next/router';
import { useTranslation } from 'next-i18next';
import { getTranslatedServerSideProps } from '@app/components/utilities/withTranslateProps';
import { CreateServiceAccountPage } from '@app/views/Settings/CreateServiceAccountPage';
export default function ServiceAccountPage() {
const router = useRouter();
// const { orgId, serviceAccountId } = router.query;
const { t } = useTranslation();
return (
<>
<Head>
<title>Edit Service Account</title>
<link rel="icon" href="/infisical.ico" />
</Head>
<div />
<CreateServiceAccountPage />
</>
);
@@ -25,7 +19,7 @@ export default function ServiceAccountPage() {
ServiceAccountPage.requireAuth = true;
export const getServerSidePros = getTranslatedServerSideProps([
export const getServerSideProps = getTranslatedServerSideProps([
'settings',
'settings-org',
'section-incident',