feat(infisical-pg): test first milestone one flow

This commit is contained in:
Akhil Mohan
2024-01-27 12:38:22 +05:30
parent aaba4a0895
commit 15b57de0ed
92 changed files with 3668 additions and 436 deletions
+1 -1
View File
@@ -72,7 +72,7 @@ export const completeAccountSignup = async (details: CompleteAccountSignupDTO) =
};
export const completeAccountSignupInvite = async (details: CompleteAccountDTO) => {
const { data } = await apiRequest.post("/api/v2/signup/complete-account/invite", details);
const { data } = await apiRequest.post("/api/v3/signup/complete-account/invite", details);
return data;
};
@@ -42,10 +42,10 @@ export const useDeleteIncidentContact = () => {
const queryClient = useQueryClient();
return useMutation<{}, {}, DeleteIncidentContactDTO>({
mutationFn: async ({ orgId, email }) => {
const { data } = await apiRequest.delete(`/api/v1/organization/${orgId}/incidentContactOrg`, {
data: { email }
});
mutationFn: async ({ orgId, incidentContactId }) => {
const { data } = await apiRequest.delete(
`/api/v1/organization/${orgId}/incidentContactOrg/${incidentContactId}`
);
return data;
},
onSuccess: (_, { orgId }) => {
@@ -9,7 +9,7 @@ export type IncidentContact = {
export type DeleteIncidentContactDTO = {
orgId: string;
email: string;
incidentContactId: string;
};
export type AddIncidentContactDTO = {
+4 -6
View File
@@ -67,13 +67,11 @@ const getUserOrgPermissions = async ({ orgId }: TGetUserOrgPermissionsDTO) => {
if (orgId === "") return { permissions: [], membership: null };
const { data } = await apiRequest.get<{
data: {
permissions: PackRule<RawRuleOf<MongoAbility<OrgPermissionSet>>>[];
membership: OrgUser;
};
}>(`/api/v1/roles/organization/${orgId}/permissions`);
permissions: PackRule<RawRuleOf<MongoAbility<OrgPermissionSet>>>[];
membership: OrgUser;
}>(`/api/ee/v1/organization/${orgId}/permissions`);
return data.data;
return data;
};
export const useGetUserOrgPermissions = ({ orgId }: TGetUserOrgPermissionsDTO) =>
+5 -4
View File
@@ -82,13 +82,14 @@ const App = ({ Component, pageProps, ...appProps }: NextAppProp): JSX.Element =>
publicPaths.includes(`/${appProps.router.pathname.split("/")[1]}`) ||
!Component.requireAuth
) {
// TODO(akhilmhdh): bring back server config later
return (
<QueryClientProvider client={queryClient}>
<NotificationProvider>
<AuthProvider>
<Component {...pageProps} />
</AuthProvider>
<ServerConfigProvider>
<AuthProvider>
<Component {...pageProps} />
</AuthProvider>
</ServerConfigProvider>
</NotificationProvider>
</QueryClientProvider>
);
@@ -95,6 +95,7 @@ export const InitialStep = ({ setStep, email, setEmail, password, setPassword }:
}
}
} catch (err) {
console.error(err);
setLoginError(true);
createNotification({
text: "Login unsuccessful. Double-check your credentials and try again.",
@@ -236,7 +237,7 @@ export const InitialStep = ({ setStep, email, setEmail, password, setPassword }:
) : (
<div />
)}
<div className="flex flex-row text-sm text-bunker-400 mt-2">
<div className="mt-2 flex flex-row text-sm text-bunker-400">
<Link href="/verify-email">
<span className="cursor-pointer duration-200 hover:text-bunker-200 hover:underline hover:decoration-primary-700 hover:underline-offset-4">
Forgot password? Recover your account
@@ -35,12 +35,12 @@ export const OrgIncidentContactsTable = () => {
const onRemoveIncidentContact = async () => {
try {
const incidentContactEmail = (popUp?.removeContact?.data as { email: string })?.email;
const incidentContactId = (popUp?.removeContact?.data as { id: string })?.id;
if (!currentOrg?.id) return;
await mutateAsync({
orgId: currentOrg.id,
email: incidentContactEmail
incidentContactId
});
createNotification({
@@ -80,7 +80,7 @@ export const OrgIncidentContactsTable = () => {
</THead>
<TBody>
{isLoading && <TableSkeleton columns={2} innerKey="incident-contact" />}
{filteredContacts?.map(({ email }) => (
{filteredContacts?.map(({ email, id }) => (
<Tr key={email}>
<Td className="w-full">{email}</Td>
<Td className="mr-4">
@@ -92,7 +92,7 @@ export const OrgIncidentContactsTable = () => {
<IconButton
ariaLabel="delete"
colorSchema="danger"
onClick={() => handlePopUpOpen("removeContact", { email })}
onClick={() => handlePopUpOpen("removeContact", { email, id })}
isDisabled={!isAllowed}
>
<FontAwesomeIcon icon={faTrash} />