Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

refactor: streamline error handling and notification logic across various components

Victor Santos1ed59a7304af
diff --git a/frontend/src/components/mfa/TotpRegistration.tsx b/frontend/src/components/mfa/TotpRegistration.tsx
index 0b79bfd989..bcb0d3691c 100644
--- a/frontend/src/components/mfa/TotpRegistration.tsx
+++ b/frontend/src/components/mfa/TotpRegistration.tsx
@@ -25,27 +25,20 @@ const TotpRegistration = ({ onComplete, shouldCenterQr }: Props) => {
const handleTotpVerify = async (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault();
- try {
- const result = await verifyUserTotp({
- totp
- });
+ const result = await verifyUserTotp({
+ totp
+ });
- createNotification({
- text: "Successfully configured mobile authenticator",
- type: "success"
- });
+ createNotification({
+ text: "Successfully configured mobile authenticator",
+ type: "success"
+ });
- if (result.recoveryCodes && result.recoveryCodes.length > 0) {
- setRecoveryCodes(result.recoveryCodes);
- setShowRecoveryModal(true);
- } else if (onComplete) {
- onComplete();
- }
- } catch {
- createNotification({
- text: "Failed to verify TOTP code",
- type: "error"
- });
+ if (result.recoveryCodes && result.recoveryCodes.length > 0) {
+ setRecoveryCodes(result.recoveryCodes);
+ setShowRecoveryModal(true);
+ } else if (onComplete) {
+ onComplete();
}
};
diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityTable.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityTable.tsx
index c4c1561e71..d202b909a6 100644
--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityTable.tsx
+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityTable.tsx
@@ -145,27 +145,16 @@ export const IdentityTable = ({ handlePopUpOpen }: Props) => {
};
const handleChangeRole = async ({ identityId, role }: { identityId: string; role: string }) => {
- try {
- await updateMutateAsync({
- identityId,
- role,
- organizationId
- });
+ await updateMutateAsync({
+ identityId,
+ role,
+ organizationId
+ });
- createNotification({
- text: "Successfully updated identity role",
- type: "success"
- });
- } catch (err) {
- console.error(err);
- const error = err as any;
- const text = error?.response?.data?.message ?? "Failed to update identity role";
-
- createNotification({
- text,
- type: "error"
- });
- }
+ createNotification({
+ text: "Successfully updated identity role",
+ type: "success"
+ });
};
const handleRoleToggle = useCallback(
diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityTlsCertAuthForm.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityTlsCertAuthForm.tsx
index 19a0499fc2..2a2ca45c3c 100644
--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityTlsCertAuthForm.tsx
+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityTlsCertAuthForm.tsx
@@ -134,47 +134,40 @@ export const IdentityTlsCertAuthForm = ({
accessTokenNumUsesLimit,
accessTokenTrustedIps
}: FormData) => {
- try {
- if (!identityId) return;
+ if (!identityId) return;
- if (data) {
- await updateMutateAsync({
- organizationId: orgId,
- caCertificate,
- allowedCommonNames: allowedCommonNames || null,
- identityId,
- accessTokenTTL: Number(accessTokenTTL),
- accessTokenMaxTTL: Number(accessTokenMaxTTL),
- accessTokenNumUsesLimit: Number(accessTokenNumUsesLimit),
- accessTokenTrustedIps
- });
- } else {
- await addMutateAsync({
- organizationId: orgId,
- identityId,
- caCertificate,
- allowedCommonNames: allowedCommonNames || undefined,
- accessTokenTTL: Number(accessTokenTTL),
- accessTokenMaxTTL: Number(accessTokenMaxTTL),
- accessTokenNumUsesLimit: Number(accessTokenNumUsesLimit),
- accessTokenTrustedIps
- });
- }
-
- handlePopUpToggle("identityAuthMethod", false);
-
- createNotification({
- text: `Successfully ${isUpdate ? "updated" : "configured"} auth method`,
- type: "success"
+ if (data) {
+ await updateMutateAsync({
+ organizationId: orgId,
+ caCertificate,
+ allowedCommonNames: allowedCommonNames || null,
+ identityId,
+ accessTokenTTL: Number(accessTokenTTL),
+ accessTokenMaxTTL: Number(accessTokenMaxTTL),
+ accessTokenNumUsesLimit: Number(accessTokenNumUsesLimit),
+ accessTokenTrustedIps
});
-
- reset();
- } catch {
- createNotification({
- text: `Failed to ${isUpdate ? "update" : "configure"} identity`,
- type: "error"
+ } else {
+ await addMutateAsync({
+ organizationId: orgId,
+ identityId,
+ caCertificate,
+ allowedCommonNames: allowedCommonNames || undefined,
+ accessTokenTTL: Number(accessTokenTTL),
+ accessTokenMaxTTL: Number(accessTokenMaxTTL),
+ accessTokenNumUsesLimit: Number(accessTokenNumUsesLimit),
+ accessTokenTrustedIps
});
}
+
+ handlePopUpToggle("identityAuthMethod", false);
+
+ createNotification({
+ text: `Successfully ${isUpdate ? "updated" : "configured"} auth method`,
+ type: "success"
+ });
+
+ reset();
};
return (
diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityTokenAuthForm.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityTokenAuthForm.tsx
index b819202fc8..8da4bad171 100644
--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityTokenAuthForm.tsx
+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityTokenAuthForm.tsx
@@ -127,43 +127,36 @@ export const IdentityTokenAuthForm = ({
accessTokenNumUsesLimit,
accessTokenTrustedIps
}: FormData) => {
- try {
- if (!identityId) return;
+ if (!identityId) return;
- if (data) {
- await updateMutateAsync({
- organizationId: orgId,
- identityId,
- accessTokenTTL: Number(accessTokenTTL),
- accessTokenMaxTTL: Number(accessTokenMaxTTL),
- accessTokenNumUsesLimit: Number(accessTokenNumUsesLimit),
- accessTokenTrustedIps
- });
- } else {
- await addMutateAsync({
- organizationId: orgId,
- identityId,
- accessTokenTTL: Number(accessTokenTTL),
- accessTokenMaxTTL: Number(accessTokenMaxTTL),
- accessTokenNumUsesLimit: Number(accessTokenNumUsesLimit),
- accessTokenTrustedIps
- });
- }
-
- handlePopUpToggle("identityAuthMethod", false);
-
- createNotification({
- text: `Successfully ${isUpdate ? "updated" : "configured"} auth method`,
- type: "success"
+ if (data) {
+ await updateMutateAsync({
+ organizationId: orgId,
+ identityId,
+ accessTokenTTL: Number(accessTokenTTL),
+ accessTokenMaxTTL: Number(accessTokenMaxTTL),
+ accessTokenNumUsesLimit: Number(accessTokenNumUsesLimit),
+ accessTokenTrustedIps
});
-
- reset();
- } catch {
- createNotification({
- text: `Failed to ${isUpdate ? "update" : "configure"} identity`,
- type: "error"
+ } else {
+ await addMutateAsync({
+ organizationId: orgId,
+ identityId,
+ accessTokenTTL: Number(accessTokenTTL),
+ accessTokenMaxTTL: Number(accessTokenMaxTTL),
+ accessTokenNumUsesLimit: Number(accessTokenNumUsesLimit),
+ accessTokenTrustedIps
});
}
+
+ handlePopUpToggle("identityAuthMethod", false);
+
+ createNotification({
+ text: `Successfully ${isUpdate ? "updated" : "configured"} auth method`,
+ type: "success"
+ });
+
+ reset();
};
return (
diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityUniversalAuthForm.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityUniversalAuthForm.tsx
index d43d84c869..dd85f53423 100644
--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityUniversalAuthForm.tsx
+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityUniversalAuthForm.tsx
@@ -220,64 +220,55 @@ export const IdentityUniversalAuthForm = ({
lockoutCounterResetValue,
lockoutCounterResetUnit
}: FormData) => {
- try {
- if (!identityId) return;
+ if (!identityId) return;
- const lockoutDurationSeconds = ms(`${lockoutDurationValue}${lockoutDurationUnit}`) / 1000;
- const lockoutCounterResetSeconds =
- ms(`${lockoutCounterResetValue}${lockoutCounterResetUnit}`) / 1000;
+ const lockoutDurationSeconds = ms(`${lockoutDurationValue}${lockoutDurationUnit}`) / 1000;
+ const lockoutCounterResetSeconds =
+ ms(`${lockoutCounterResetValue}${lockoutCounterResetUnit}`) / 1000;
- if (data) {
- // update universal auth configuration
- await updateMutateAsync({
- organizationId: orgId,
- identityId,
- clientSecretTrustedIps,
- accessTokenTTL: Number(accessTokenTTL),
- accessTokenMaxTTL: Number(accessTokenMaxTTL),
- accessTokenNumUsesLimit: Number(accessTokenNumUsesLimit),
- accessTokenTrustedIps,
- accessTokenPeriod: Number(accessTokenPeriod),
- lockoutEnabled,
- lockoutThreshold: Number(lockoutThreshold),
- lockoutDurationSeconds,
- lockoutCounterResetSeconds
- });
- } else {
- // create new universal auth configuration
-
- await addMutateAsync({
- organizationId: orgId,
- identityId,
- clientSecretTrustedIps,
- accessTokenTTL: Number(accessTokenTTL),
- accessTokenMaxTTL: Number(accessTokenMaxTTL),
- accessTokenNumUsesLimit: Number(accessTokenNumUsesLimit),
- accessTokenTrustedIps,
- accessTokenPeriod: Number(accessTokenPeriod),
- lockoutEnabled,
- lockoutThreshold: Number(lockoutThreshold),
- lockoutDurationSeconds: Number(lockoutDurationSeconds),
- lockoutCounterResetSeconds: Number(lockoutCounterResetSeconds)
- });
- }
-
- handlePopUpToggle("identityAuthMethod", false);
-
- createNotification({
- text: `Successfully ${isUpdate ? "updated" : "created"} auth method`,
- type: "success"
+ if (data) {
+ // update universal auth configuration
+ await updateMutateAsync({
+ organizationId: orgId,
+ identityId,
+ clientSecretTrustedIps,
+ accessTokenTTL: Number(accessTokenTTL),
+ accessTokenMaxTTL: Number(accessTokenMaxTTL),
+ accessTokenNumUsesLimit: Number(accessTokenNumUsesLimit),
+ accessTokenTrustedIps,
+ accessTokenPeriod: Number(accessTokenPeriod),
+ lockoutEnabled,
+ lockoutThreshold: Number(lockoutThreshold),
+ lockoutDurationSeconds,
+ lockoutCounterResetSeconds
});
+ } else {
+ // create new universal auth configuration
- reset();
- } catch {
- const text = `Failed to ${isUpdate ? "update" : "configure"} identity`;
-
- createNotification({
- text,
- type: "error"
+ await addMutateAsync({
+ organizationId: orgId,
+ identityId,
+ clientSecretTrustedIps,
+ accessTokenTTL: Number(accessTokenTTL),
+ accessTokenMaxTTL: Number(accessTokenMaxTTL),
+ accessTokenNumUsesLimit: Number(accessTokenNumUsesLimit),
+ accessTokenTrustedIps,
+ accessTokenPeriod: Number(accessTokenPeriod),
+ lockoutEnabled,
+ lockoutThreshold: Number(lockoutThreshold),
+ lockoutDurationSeconds: Number(lockoutDurationSeconds),
+ lockoutCounterResetSeconds: Number(lockoutCounterResetSeconds)
});
}
+
+ handlePopUpToggle("identityAuthMethod", false);
+
+ createNotification({
+ text: `Successfully ${isUpdate ? "updated" : "created"} auth method`,
+ type: "success"
+ });
+
+ reset();
};
return (
diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgMembersTab/components/OrgMembersSection/AddOrgMemberModal.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgMembersTab/components/OrgMembersSection/AddOrgMemberModal.tsx
index e49beadae8..da88603fc4 100644
--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgMembersTab/components/OrgMembersSection/AddOrgMemberModal.tsx
+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgMembersTab/components/OrgMembersSection/AddOrgMemberModal.tsx
@@ -122,62 +122,53 @@ export const AddOrgMemberModal = ({
}
}
- try {
- const parsedEmails = emails
- .replace(/\s/g, "")
- .split(",")
- .map((email) => {
- if (EmailSchema.safeParse(email).success) {
- return email.trim();
- }
-
- return null;
- });
+ const parsedEmails = emails
+ .replace(/\s/g, "")
+ .split(",")
+ .map((email) => {
+ if (EmailSchema.safeParse(email).success) {
+ return email.trim();
+ }
- if (parsedEmails.includes(null)) {
- createNotification({
- text: "Invalid email addresses provided.",
- type: "error"
- });
- return;
- }
+ return null;
+ });
- const usernames = emails.split(",").map((email) => email.trim());
- const { data } = await addUsersMutateAsync({
- organizationId: currentOrg?.id,
- inviteeEmails: usernames,
- organizationRoleSlug: organizationRole.slug
+ if (parsedEmails.includes(null)) {
+ createNotification({
+ text: "Invalid email addresses provided.",
+ type: "error"
});
+ return;
+ }
- await Promise.allSettled(
- selectedProjects.map((el) =>
- addUserToProject({
- orgId: currentOrg.id,
- projectId: el.id,
- roleSlugs: [projectRoleSlug],
- usernames
- })
- )
- );
+ const usernames = emails.split(",").map((email) => email.trim());
+ const { data } = await addUsersMutateAsync({
+ organizationId: currentOrg?.id,
+ inviteeEmails: usernames,
+ organizationRoleSlug: organizationRole.slug
+ });
- setCompleteInviteLinks(data?.completeInviteLinks ?? null);
+ await Promise.allSettled(
+ selectedProjects.map((el) =>
+ addUserToProject({
+ orgId: currentOrg.id,
+ projectId: el.id,
+ roleSlugs: [projectRoleSlug],
+ usernames
+ })
+ )
+ );
- // only show this notification when email is configured.
- // A [completeInviteLink] will not be sent if smtp is configured
+ setCompleteInviteLinks(data?.completeInviteLinks ?? null);
- if (!data.completeInviteLinks) {
- createNotification({
- text: "Successfully invited user to the organization.",
- type: "success"
- });
- }
- } catch (error) {
- console.error(error);
+ // only show this notification when email is configured.
+ // A [completeInviteLink] will not be sent if smtp is configured
+
+ if (!data.completeInviteLinks) {
createNotification({
- text: "Failed to invite user to org",
- type: "error"
+ text: "Successfully invited user to the organization.",
+ type: "success"
});
- return;
}
if (serverDetails?.emailConfigured) {
diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgMembersTab/components/OrgMembersSection/AddSubOrgMemberModal.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgMembersTab/components/OrgMembersSection/AddSubOrgMemberModal.tsx
index 290f8db4b8..5edba7cde7 100644
--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgMembersTab/components/OrgMembersSection/AddSubOrgMemberModal.tsx
+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgMembersTab/components/OrgMembersSection/AddSubOrgMemberModal.tsx
@@ -106,32 +106,24 @@ export const AddSubOrgMemberModal = ({ onClose }: Props) => {
}
}
- try {
- const usernames = users.map((el) => el.username);
- await addUsersMutateAsync({
- organizationId: currentOrg?.id,
- inviteeEmails: usernames,
- organizationRoleSlug: organizationRole.slug
- });
+ const usernames = users.map((el) => el.username);
+ await addUsersMutateAsync({
+ organizationId: currentOrg?.id,
+ inviteeEmails: usernames,
+ organizationRoleSlug: organizationRole.slug
+ });
- await Promise.allSettled(
- selectedProjects.map((el) =>
- addUserToProject({
- orgId: currentOrg.id,
- projectId: el.id,
- roleSlugs: [projectRoleSlug],
- usernames
- })
- )
- );
- onClose();
- } catch (error) {
- console.error(error);
- createNotification({
- text: "Failed to add user to suborganization",
- type: "error"
- });
- }
+ await Promise.allSettled(
+ selectedProjects.map((el) =>
+ addUserToProject({
+ orgId: currentOrg.id,
+ projectId: el.id,
+ roleSlugs: [projectRoleSlug],
+ usernames
+ })
+ )
+ );
+ onClose();
};
const getGroupHeaderLabel = (type: ProjectType) => {
diff --git a/frontend/src/pages/organization/AccessManagementPage/components/UpgradePrivilegeSystemModal/UpgradePrivilegeSystemModal.tsx b/frontend/src/pages/organization/AccessManagementPage/components/UpgradePrivilegeSystemModal/UpgradePrivilegeSystemModal.tsx
index 97aaff73db..c2a2008057 100644
--- a/frontend/src/pages/organization/AccessManagementPage/components/UpgradePrivilegeSystemModal/UpgradePrivilegeSystemModal.tsx
+++ b/frontend/src/pages/organization/AccessManagementPage/components/UpgradePrivilegeSystemModal/UpgradePrivilegeSystemModal.tsx
@@ -44,21 +44,14 @@ export const UpgradePrivilegeSystemModal = ({ isOpen, onOpenChange }: Props) =>
acknowledgesPermanentChange;
const handlePrivilegeSystemUpgrade = async () => {
- try {
- await upgradePrivilegeSystem();
+ await upgradePrivilegeSystem();
- createNotification({
- text: "Privilege system upgrade completed",
- type: "success"
- });
+ createNotification({
+ text: "Privilege system upgrade completed",
+ type: "success"
+ });
- onOpenChange(false);
- } catch {
- createNotification({
- text: "Failed to upgrade privilege system",
- type: "error"
- });
- }
+ onOpenChange(false);
};
const handleClose = () => {
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/DeleteAppConnectionModal.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/DeleteAppConnectionModal.tsx
index e5f6b36840..f5782adbbc 100644
--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/DeleteAppConnectionModal.tsx
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/DeleteAppConnectionModal.tsx
@@ -18,26 +18,17 @@ export const DeleteAppConnectionModal = ({ isOpen, onOpenChange, appConnection }
const { id: connectionId, name, app } = appConnection;
const handleDeleteAppConnection = async () => {
- try {
- await deleteAppConnection.mutateAsync({
- connectionId,
- app
- });
-
- createNotification({
- text: `Successfully removed ${APP_CONNECTION_MAP[app].name} connection`,
- type: "success"
- });
-
- onOpenChange(false);
- } catch (err) {
- console.error(err);
-
- createNotification({
- text: `Failed to remove ${APP_CONNECTION_MAP[app].name} connection`,
- type: "error"
- });
- }
+ await deleteAppConnection.mutateAsync({
+ connectionId,
+ app
+ });
+
+ createNotification({
+ text: `Successfully removed ${APP_CONNECTION_MAP[app].name} connection`,
+ type: "success"
+ });
+
+ onOpenChange(false);
};
return (
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/EditAppConnectionDetailsModal.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/EditAppConnectionDetailsModal.tsx
index f46a3b3cf6..7d1a542c0e 100644
--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/EditAppConnectionDetailsModal.tsx
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/EditAppConnectionDetailsModal.tsx
@@ -43,24 +43,15 @@ const Content = ({ appConnection, onComplete }: ContentProps) => {
} = form;
const onSubmit = async (formData: FormData) => {
- try {
- await updateAppConnection.mutateAsync({
- connectionId: appConnection.id,
- ...formData
- });
- createNotification({
- text: `Successfully updated ${appName} Connection`,
- type: "success"
- });
- onComplete();
- } catch (err: any) {
- console.error(err);
- createNotification({
- title: `Failed to update ${appName} Connection`,
- text: err.message,
- type: "error"
- });
- }
+ await updateAppConnection.mutateAsync({
+ connectionId: appConnection.id,
+ ...formData
+ });
+ createNotification({
+ text: `Successfully updated ${appName} Connection`,
+ type: "success"
+ });
+ onComplete();
};
return (
diff --git a/frontend/src/pages/organization/AppConnections/OauthCallbackPage/OauthCallbackPage.tsx b/frontend/src/pages/organization/AppConnections/OauthCallbackPage/OauthCallbackPage.tsx
index df3d1327a5..96a474714d 100644
--- a/frontend/src/pages/organization/AppConnections/OauthCallbackPage/OauthCallbackPage.tsx
+++ b/frontend/src/pages/organization/AppConnections/OauthCallbackPage/OauthCallbackPage.tsx
@@ -127,12 +127,7 @@ export const OAuthCallbackPage = () => {
projectId,
connection
};
- } catch (err: any) {
- createNotification({
- title: `Failed to ${connectionId ? "update" : "add"} GitLab Connection`,
- text: err?.message,
- type: "error"
- });
+ } catch {
navigate({
to: returnUrl,
params: {
@@ -176,12 +171,7 @@ export const OAuthCallbackPage = () => {
}
});
}
- } catch (err: any) {
- createNotification({
- title: `Failed to ${connectionId ? "update" : "add"} Azure Key Vault Connection`,
- text: err?.message,
- type: "error"
- });
+ } catch {
navigate({
to: returnUrl,
params: {
@@ -233,12 +223,7 @@ export const OAuthCallbackPage = () => {
}
});
}
- } catch (err: any) {
- createNotification({
- title: `Failed to ${connectionId ? "update" : "add"} Azure App Configuration Connection`,
- text: err?.message,
- type: "error"
- });
+ } catch {
navigate({
to: returnUrl,
params: {
@@ -290,12 +275,7 @@ export const OAuthCallbackPage = () => {
}
});
}
- } catch (err: any) {
- createNotification({
- title: `Failed to ${connectionId ? "update" : "add"} Azure Client Secrets Connection`,
- text: err?.message,
- type: "error"
- });
+ } catch {
navigate({
to: returnUrl,
params: {
@@ -353,12 +333,7 @@ export const OAuthCallbackPage = () => {
}
});
}
- } catch (err: any) {
- createNotification({
- title: `Failed to ${connectionId ? "update" : "add"} Azure DevOps Connection`,
- text: err?.message,
- type: "error"
- });
+ } catch {
navigate({
to: returnUrl,
params: {
@@ -441,12 +416,7 @@ export const OAuthCallbackPage = () => {
})
});
}
- } catch (e: any) {
- createNotification({
- title: `Failed to ${connectionId ? "update" : "add"} GitHub Connection`,
- text: e.message,
- type: "error"
- });
+ } catch {
navigate({
to: returnUrl,
params: {
@@ -498,12 +468,7 @@ export const OAuthCallbackPage = () => {
}
});
}
- } catch (e: any) {
- createNotification({
- title: `Failed to ${connectionId ? "update" : "add"} GitHub Radar Connection`,
- text: e.message,
- type: "error"
- });
+ } catch {
navigate({
to: returnUrl,
params: {
@@ -553,12 +518,7 @@ export const OAuthCallbackPage = () => {
}
});
}
- } catch (e: any) {
- createNotification({
- title: `Failed to ${connectionId ? "update" : "add"} Heroku Connection`,
- text: e.message,
- type: "error"
- });
+ } catch {
navigate({
to: returnUrl,
params: {
diff --git a/frontend/src/pages/organization/BillingPage/components/BillingDetailsTab/CompanyNameSection.tsx b/frontend/src/pages/organization/BillingPage/components/BillingDetailsTab/CompanyNameSection.tsx
index fce3978c74..f63b5d6d13 100644
--- a/frontend/src/pages/organization/BillingPage/components/BillingDetailsTab/CompanyNameSection.tsx
+++ b/frontend/src/pages/organization/BillingPage/components/BillingDetailsTab/CompanyNameSection.tsx
@@ -35,25 +35,17 @@ export const CompanyNameSection = () => {
}, [data]);
const onFormSubmit = async ({ name }: { name: string }) => {
- try {
- if (!currentOrg?.id) return;
- if (name === "") return;
- await mutateAsync({
- name,
- organizationId: currentOrg.id
- });
+ if (!currentOrg?.id) return;
+ if (name === "") return;
+ await mutateAsync({
+ name,
+ organizationId: currentOrg.id
+ });
- createNotification({
- text: "Successfully updated business name",
- type: "success"
- });
- } catch (err) {
- console.error(err);
- createNotification({
- text: "Failed to update business name",
- type: "error"
- });
- }
+ createNotification({
+ text: "Successfully updated business name",
+ type: "success"
+ });
};
return (
diff --git a/frontend/src/pages/organization/BillingPage/components/BillingDetailsTab/InvoiceEmailSection.tsx b/frontend/src/pages/organization/BillingPage/components/BillingDetailsTab/InvoiceEmailSection.tsx
index 8b471346ff..dc05a72086 100644
--- a/frontend/src/pages/organization/BillingPage/components/BillingDetailsTab/InvoiceEmailSection.tsx
+++ b/frontend/src/pages/organization/BillingPage/components/BillingDetailsTab/InvoiceEmailSection.tsx
@@ -35,26 +35,18 @@ export const InvoiceEmailSection = () => {
}, [data]);
const onFormSubmit = async ({ email }: { email: string }) => {
- try {
- if (!currentOrg?.id) return;
- if (email === "") return;
+ if (!currentOrg?.id) return;
+ if (email === "") return;
- await mutateAsync({
- email,
- organizationId: currentOrg.id
- });
+ await mutateAsync({
+ email,
+ organizationId: currentOrg.id
+ });
- createNotification({
- text: "Successfully updated invoice email recipient",
- type: "success"
- });
- } catch (err) {
- console.error(err);
- createNotification({
- text: "Failed to update invoice email recipient",
- type: "error"
- });
- }
+ createNotification({
+ text: "Successfully updated invoice email recipient",
+ type: "success"
+ });
};
return (
diff --git a/frontend/src/pages/organization/BillingPage/components/BillingDetailsTab/PmtMethodsTable.tsx b/frontend/src/pages/organization/BillingPage/components/BillingDetailsTab/PmtMethodsTable.tsx
index bf0851e119..15a6bc8e9d 100644
--- a/frontend/src/pages/organization/BillingPage/components/BillingDetailsTab/PmtMethodsTable.tsx
+++ b/frontend/src/pages/organization/BillingPage/components/BillingDetailsTab/PmtMethodsTable.tsx
@@ -39,22 +39,15 @@ export const PmtMethodsTable = () => {
});
return;
}
- try {
- await deleteOrgPmtMethod.mutateAsync({
- organizationId: currentOrg.id,
- pmtMethodId: pmtMethodToRemove.id
- });
- createNotification({
- type: "success",
- text: "Successfully removed payment method"
- });
- handlePopUpClose("removeCard");
- } catch (error: any) {
- createNotification({
- type: "error",
- text: error.message ?? "Error removing payment method"
- });
- }
+ await deleteOrgPmtMethod.mutateAsync({
+ organizationId: currentOrg.id,
+ pmtMethodId: pmtMethodToRemove.id
+ });
+ createNotification({
+ type: "success",
+ text: "Successfully removed payment method"
+ });
+ handlePopUpClose("removeCard");
};
return (
diff --git a/frontend/src/pages/organization/BillingPage/components/BillingDetailsTab/TaxIDModal.tsx b/frontend/src/pages/organization/BillingPage/components/BillingDetailsTab/TaxIDModal.tsx
index 01b11e81a0..23542ac8d7 100644
--- a/frontend/src/pages/organization/BillingPage/components/BillingDetailsTab/TaxIDModal.tsx
+++ b/frontend/src/pages/organization/BillingPage/components/BillingDetailsTab/TaxIDModal.tsx
@@ -98,26 +98,18 @@ export const TaxIDModal = ({ popUp, handlePopUpClose, handlePopUpToggle }: Props
});
const onTaxIDModalSubmit = async ({ type, value }: AddTaxIDFormData) => {
- try {
- if (!currentOrg?.id) return;
- await addOrgTaxId.mutateAsync({
- organizationId: currentOrg.id,
- type,
- value
- });
+ if (!currentOrg?.id) return;
+ await addOrgTaxId.mutateAsync({
+ organizationId: currentOrg.id,
+ type,
+ value
+ });
- createNotification({
- text: "Successfully added Tax ID",
- type: "success"
- });
- handlePopUpClose("addTaxID");
- } catch (err) {
- console.error(err);
- createNotification({
- text: "Failed to add Tax ID",
- type: "error"
- });
- }
+ createNotification({
+ text: "Successfully added Tax ID",
+ type: "success"
+ });
+ handlePopUpClose("addTaxID");
};
return (
diff --git a/frontend/src/pages/organization/GroupDetailsByIDPage/GroupDetailsByIDPage.tsx b/frontend/src/pages/organization/GroupDetailsByIDPage/GroupDetailsByIDPage.tsx
index b33ce0ef20..57c7b5a7dc 100644
--- a/frontend/src/pages/organization/GroupDetailsByIDPage/GroupDetailsByIDPage.tsx
+++ b/frontend/src/pages/organization/GroupDetailsByIDPage/GroupDetailsByIDPage.tsx
@@ -56,27 +56,19 @@ const Page = () => {
] as const);
const onDeleteGroupSubmit = async ({ name, id }: { name: string; id: string }) => {
- try {
- await deleteMutateAsync({
- id
- });
- createNotification({
- text: `Successfully deleted the ${name} group`,
- type: "success"
- });
- navigate({
- to: "/organization/access-management" as const,
- search: {
- selectedTab: TabSections.Groups
- }
- });
- } catch (err) {
- console.error(err);
- createNotification({
- text: `Failed to delete the ${name} group`,
- type: "error"
- });
- }
+ await deleteMutateAsync({
+ id
+ });
+ createNotification({
+ text: `Successfully deleted the ${name} group`,
+ type: "success"
+ });
+ navigate({
+ to: "/organization/access-management" as const,
+ search: {
+ selectedTab: TabSections.Groups
+ }
+ });
handlePopUpClose("deleteGroup");
};
diff --git a/frontend/src/pages/organization/GroupDetailsByIDPage/components/AddGroupMemberModal.tsx b/frontend/src/pages/organization/GroupDetailsByIDPage/components/AddGroupMemberModal.tsx
index 0995830e56..b9d1b184c3 100644
--- a/frontend/src/pages/organization/GroupDetailsByIDPage/components/AddGroupMemberModal.tsx
+++ b/frontend/src/pages/organization/GroupDetailsByIDPage/components/AddGroupMemberModal.tsx
@@ -63,31 +63,24 @@ export const AddGroupMembersModal = ({ popUp, handlePopUpToggle }: Props) => {
const { mutateAsync: addUserToGroupMutateAsync } = useAddUserToGroup();
const handleAddMember = async (username: string) => {
- try {
- if (!popUpData?.slug) {
- createNotification({
- text: "Some data is missing, please refresh the page and try again",
- type: "error"
- });
- return;
- }
-
- await addUserToGroupMutateAsync({
- groupId: popUpData.groupId,
- username,
- slug: popUpData.slug
- });
-
+ if (!popUpData?.slug) {
createNotification({
- text: "Successfully assigned user to the group",
- type: "success"
- });
- } catch {
- createNotification({
- text: "Failed to assign user to the group",
+ text: "Some data is missing, please refresh the page and try again",
type: "error"
});
+ return;
}
+
+ await addUserToGroupMutateAsync({
+ groupId: popUpData.groupId,
+ username,
+ slug: popUpData.slug
+ });
+
+ createNotification({
+ text: "Successfully assigned user to the group",
+ type: "success"
+ });
};
return (
diff --git a/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembersSection.tsx b/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembersSection.tsx
index 2ca6859b04..c78b5404e7 100644
--- a/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembersSection.tsx
+++ b/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembersSection.tsx
@@ -29,25 +29,18 @@ export const GroupMembersSection = ({ groupId, groupSlug }: Props) => {
const { mutateAsync: removeUserFromGroupMutateAsync } = useRemoveUserFromGroup();
const handleRemoveUserFromGroup = async (username: string) => {
- try {
- await removeUserFromGroupMutateAsync({
- groupId,
- username,
- slug: groupSlug
- });
+ await removeUserFromGroupMutateAsync({
+ groupId,
+ username,
+ slug: groupSlug
+ });
- createNotification({
- text: `Successfully removed user ${username} from the group`,
- type: "success"
- });
+ createNotification({
+ text: `Successfully removed user ${username} from the group`,
+ type: "success"
+ });
- handlePopUpToggle("removeMemberFromGroup", false);
- } catch {
- createNotification({
- text: `Failed to remove user ${username} from the group`,
- type: "error"
- });
- }
+ handlePopUpToggle("removeMemberFromGroup", false);
};
return (
diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityProjectsSection/IdentityAddToProjectModal.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityProjectsSection/IdentityAddToProjectModal.tsx
index 2e5c7101c7..2f407142ad 100644
--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityProjectsSection/IdentityAddToProjectModal.tsx
+++ b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityProjectsSection/IdentityAddToProjectModal.tsx
@@ -75,30 +75,19 @@ const Content = ({ identityId, handlePopUpToggle }: Omit<Props, "popUp">) => {
}, [workspaces, projectMemberships]);
const onFormSubmit = async ({ project: selectedProject, role }: FormData) => {
- try {
- await addIdentityToWorkspace({
- projectId: selectedProject.id,
- identityId,
- role: role.slug || undefined
- });
-
- createNotification({
- text: "Successfully added identity to project",
- type: "success"
- });
-
- reset();
- handlePopUpToggle("addIdentityToProject", false);
- } catch (err) {
- console.error(err);
- const error = err as any;
- const text = error?.response?.data?.message ?? "Failed to add identity to project";
-
- createNotification({
- text,
- type: "error"
- });
- }
+ await addIdentityToWorkspace({
+ projectId: selectedProject.id,
+ identityId,
+ role: role.slug || undefined
+ });
+
+ createNotification({
+ text: "Successfully added identity to project",
+ type: "success"
+ });
+
+ reset();
+ handlePopUpToggle("addIdentityToProject", false);
};
const isProjectSelected = Boolean(projectId);
diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityProjectsSection/IdentityProjectsSection.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityProjectsSection/IdentityProjectsSection.tsx
index 6530b9ae5a..8d67ef6a4d 100644
--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityProjectsSection/IdentityProjectsSection.tsx
+++ b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityProjectsSection/IdentityProjectsSection.tsx
@@ -22,28 +22,17 @@ export const IdentityProjectsSection = ({ identityId }: Props) => {
] as const);
const onRemoveIdentitySubmit = async (id: string, projectId: string) => {
- try {
- await deleteMutateAsync({
- identityId: id,
- projectId
- });
+ await deleteMutateAsync({
+ identityId: id,
+ projectId
+ });
- createNotification({
- text: "Successfully removed identity from project",
- type: "success"
- });
+ createNotification({
+ text: "Successfully removed identity from project",
+ type: "success"
+ });
- handlePopUpClose("removeIdentityFromProject");
- } catch (err) {
- console.error(err);
- const error = err as any;
- const text = error?.response?.data?.message ?? "Failed to remove identity from project";
-
- createNotification({
- text,
- type: "error"
- });
- }
+ handlePopUpClose("removeIdentityFromProject");
};
return (
diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityTokenModal.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityTokenModal.tsx
index d2b865a5a3..d5c1aa2ac8 100644
--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityTokenModal.tsx
+++ b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityTokenModal.tsx
@@ -72,46 +72,33 @@ export const IdentityTokenModal = ({ popUp, handlePopUpToggle }: Props) => {
}, [popUp?.token?.data]);
const onFormSubmit = async ({ name }: FormData) => {
- try {
- if (tokenData?.tokenId) {
- // update
-
- await updateToken({
- identityId: tokenData.identityId,
- tokenId: tokenData.tokenId,
- name
- });
-
- handlePopUpToggle("token", false);
- } else {
- // create
-
- const newTokenData = await createToken({
- identityId: tokenData.identityId,
- name
- });
-
- setToken(newTokenData.accessToken);
- }
-
- createNotification({
- text: `Successfully ${popUp?.token?.data ? "updated" : "created"} token`,
- type: "success"
+ if (tokenData?.tokenId) {
+ // update
+
+ await updateToken({
+ identityId: tokenData.identityId,
+ tokenId: tokenData.tokenId,
+ name
});
- reset();
- } catch (err) {
- console.error(err);
- const error = err as any;
- const text =
- error?.response?.data?.message ??
- `Failed to ${popUp?.token?.data ? "update" : "create"} token`;
-
- createNotification({
- text,
- type: "error"
+ handlePopUpToggle("token", false);
+ } else {
+ // create
+
+ const newTokenData = await createToken({
+ identityId: tokenData.identityId,
+ name
});
+
+ setToken(newTokenData.accessToken);
}
+
+ createNotification({
+ text: `Successfully ${popUp?.token?.data ? "updated" : "created"} token`,
+ type: "success"
+ });
+
+ reset();
};
return (
diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/IdentityAuthLockoutFields.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/IdentityAuthLockoutFields.tsx
index b5cb2d901d..4ec5871a22 100644
--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/IdentityAuthLockoutFields.tsx
+++ b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/IdentityAuthLockoutFields.tsx
@@ -31,23 +31,15 @@ export const LockoutFields = ({
const [lockedOutState, setLockedOutState] = useState(lockedOut);
- async function clearLockouts() {
- try {
- const deleted = await mutateAsync({ identityId });
- createNotification({
- text: `Successfully cleared ${deleted} lockout${deleted === 1 ? "" : "s"}`,
- type: "success"
- });
- setLockedOutState(false);
- onResetAllLockouts();
- } catch (error) {
- console.error(error);
- createNotification({
- text: "Failed to clear lockouts. Please try again.",
- type: "error"
- });
- }
- }
+ const clearLockouts = async () => {
+ const deleted = await mutateAsync({ identityId });
+ createNotification({
+ text: `Successfully cleared ${deleted} lockout${deleted === 1 ? "" : "s"}`,
+ type: "success"
+ });
+ setLockedOutState(false);
+ onResetAllLockouts();
+ };
return (
<>
diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/IdentityTokenAuthTokensTable.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/IdentityTokenAuthTokensTable.tsx
index be9c166b3e..cc11d9d10b 100644
--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/IdentityTokenAuthTokensTable.tsx
+++ b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/IdentityTokenAuthTokensTable.tsx
@@ -51,28 +51,17 @@ export const IdentityTokenAuthTokensTable = ({ tokens, identityId }: Props) => {
tokenId: string;
name: string;
}) => {
- try {
- await revokeToken({
- identityId: parentIdentityId,
- tokenId
- });
+ await revokeToken({
+ identityId: parentIdentityId,
+ tokenId
+ });
- handlePopUpClose("revokeToken");
+ handlePopUpClose("revokeToken");
- createNotification({
- text: `Successfully revoked token ${name ?? ""}`,
- type: "success"
- });
- } catch (err) {
- console.error(err);
- const error = err as any;
- const text = error?.response?.data?.message ?? "Failed to revoke token";
-
- createNotification({
- text,
- type: "error"
- });
- }
+ createNotification({
+ text: `Successfully revoked token ${name ?? ""}`,
+ type: "success"
+ });
};
return (
diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/IdentityUniversalAuthClientSecretsTable.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/IdentityUniversalAuthClientSecretsTable.tsx
index b034b5367d..017f30719f 100644
--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/IdentityUniversalAuthClientSecretsTable.tsx
+++ b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/IdentityUniversalAuthClientSecretsTable.tsx
@@ -43,25 +43,17 @@ export const IdentityUniversalAuthClientSecretsTable = ({ clientSecrets, identit
const { mutateAsync: revokeClientSecret } = useRevokeIdentityUniversalAuthClientSecret();
const onDeleteClientSecretSubmit = async (clientSecretId: string) => {
- try {
- await revokeClientSecret({
- identityId,
- clientSecretId
- });
+ await revokeClientSecret({
+ identityId,
+ clientSecretId
+ });
- handlePopUpToggle("revokeClientSecret", false);
+ handlePopUpToggle("revokeClientSecret", false);
- createNotification({
- text: "Successfully deleted client secret",
- type: "success"
- });
- } catch (err) {
- console.error(err);
- createNotification({
- text: "Failed to delete client secret",
- type: "error"
- });
- }
+ createNotification({
+ text: "Successfully deleted client secret",
+ type: "success"
+ });
};
return (
diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityAuthModal.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityAuthModal.tsx
index f95a20789c..09fc9f67e0 100644
--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityAuthModal.tsx
+++ b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityAuthModal.tsx
@@ -140,25 +140,17 @@ export const Content = ({
}
const handleDeleteAuthMethod = async () => {
- try {
- await revokeMethod({
- identityId,
- organizationId: orgId
- });
+ await revokeMethod({
+ identityId,
+ organizationId: orgId
+ });
- createNotification({
- text: "Successfully removed auth method",
- type: "success"
- });
-
- handlePopUpToggle("revokeAuthMethod", false);
- onDeleteAuthMethod();
- } catch {
- createNotification({
- text: "Failed to remove auth method",
- type: "error"
- });
- }
+ createNotification({
+ text: "Successfully removed auth method",
+ type: "success"
+ });
+ handlePopUpToggle("revokeAuthMethod", false);
+ onDeleteAuthMethod();
};
return (
diff --git a/frontend/src/pages/organization/NetworkingPage/components/GatewayTab/components/GatewayCliDeploymentMethod.tsx b/frontend/src/pages/organization/NetworkingPage/components/GatewayTab/components/GatewayCliDeploymentMethod.tsx
index 7537d95a3d..8e69e7c0a5 100644
--- a/frontend/src/pages/organization/NetworkingPage/components/GatewayTab/components/GatewayCliDeploymentMethod.tsx
+++ b/frontend/src/pages/organization/NetworkingPage/components/GatewayTab/components/GatewayCliDeploymentMethod.tsx
@@ -168,12 +168,7 @@ export const GatewayCliDeploymentMethod = () => {
type: "info"
});
setStep("command");
- } catch (err) {
- console.error(err);
- createNotification({
- text: "Failed to generate token for the selected identity",
- type: "error"
- });
+ } catch {
setIdentityToken("");
}
} else {
diff --git a/frontend/src/pages/organization/NetworkingPage/components/RelayTab/components/RelayCliDeploymentMethod.tsx b/frontend/src/pages/organization/NetworkingPage/components/RelayTab/components/RelayCliDeploymentMethod.tsx
index 1d89e98775..f41f8204bf 100644
--- a/frontend/src/pages/organization/NetworkingPage/components/RelayTab/components/RelayCliDeploymentMethod.tsx
+++ b/frontend/src/pages/organization/NetworkingPage/components/RelayTab/components/RelayCliDeploymentMethod.tsx
@@ -141,12 +141,7 @@ export const RelayCliDeploymentMethod = () => {
type: "info"
});
setStep("command");
- } catch (err) {
- console.error(err);
- createNotification({
- text: "Failed to generate token for the selected identity",
- type: "error"
- });
+ } catch {
setIdentityToken("");
}
} else {
diff --git a/frontend/src/pages/organization/ProjectsPage/components/AllProjectView.tsx b/frontend/src/pages/organization/ProjectsPage/components/AllProjectView.tsx
index cf60ffa598..a1bd8c9e45 100644
--- a/frontend/src/pages/organization/ProjectsPage/components/AllProjectView.tsx
+++ b/frontend/src/pages/organization/ProjectsPage/components/AllProjectView.tsx
@@ -13,7 +13,6 @@ import { useNavigate } from "@tanstack/react-router";
import { CheckIcon } from "lucide-react";
import { twMerge } from "tailwind-merge";
-import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
import { RequestProjectAccessModal } from "@app/components/projects/RequestProjectAccessModal";
import {
@@ -103,22 +102,15 @@ export const AllProjectView = ({
projectId: string,
environments: ProjectEnv[]
) => {
- try {
- await orgAdminAccessProject.mutateAsync({
+ await orgAdminAccessProject.mutateAsync({
+ projectId
+ });
+ await navigate({
+ to: getProjectHomePage(type, environments),
+ params: {
projectId
- });
- await navigate({
- to: getProjectHomePage(type, environments),
- params: {
- projectId
- }
- });
- } catch {
- createNotification({
- text: "Failed to access project",
- type: "error"
- });
- }
+ }
+ });
};
useResetPageHelper({
diff --git a/frontend/src/pages/organization/ProjectsPage/components/MyProjectView.tsx b/frontend/src/pages/organization/ProjectsPage/components/MyProjectView.tsx
index a86023b6ce..32301923bd 100644
--- a/frontend/src/pages/organization/ProjectsPage/components/MyProjectView.tsx
+++ b/frontend/src/pages/organization/ProjectsPage/components/MyProjectView.tsx
@@ -15,7 +15,6 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { useNavigate } from "@tanstack/react-router";
import { twMerge } from "tailwind-merge";
-import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
import {
Button,
@@ -158,32 +157,18 @@ export const MyProjectView = ({
};
const addProjectToFavorites = async (projectId: string) => {
- try {
- if (currentOrg?.id) {
- await updateUserProjectFavorites({
- orgId: currentOrg?.id,
- projectFavorites: [...(projectFavorites || []), projectId]
- });
- }
- } catch {
- createNotification({
- text: "Failed to add project to favorites.",
- type: "error"
+ if (currentOrg?.id) {
+ await updateUserProjectFavorites({
+ orgId: currentOrg?.id,
+ projectFavorites: [...(projectFavorites || []), projectId]
});
}
};
const removeProjectFromFavorites = async (projectId: string) => {
- try {
- if (currentOrg?.id) {
- await updateUserProjectFavorites({
- orgId: currentOrg?.id,
- projectFavorites: [...(projectFavorites || []).filter((entry) => entry !== projectId)]
- });
- }
- } catch {
- createNotification({
- text: "Failed to remove project from favorites.",
- type: "error"
+ if (currentOrg?.id) {
+ await updateUserProjectFavorites({
+ orgId: currentOrg?.id,
+ projectFavorites: [...(projectFavorites || []).filter((entry) => entry !== projectId)]
});
}
};
diff --git a/frontend/src/pages/organization/RoleByIDPage/RoleByIDPage.tsx b/frontend/src/pages/organization/RoleByIDPage/RoleByIDPage.tsx
index 0d30dd2f82..78c5393a7c 100644
--- a/frontend/src/pages/organization/RoleByIDPage/RoleByIDPage.tsx
+++ b/frontend/src/pages/organization/RoleByIDPage/RoleByIDPage.tsx
@@ -42,36 +42,25 @@ export const Page = () => {
] as const);
const onDeleteOrgRoleSubmit = async () => {
- try {
- if (!orgId || !roleId) return;
+ if (!orgId || !roleId) return;
- await deleteOrgRole({
- orgId,
- id: roleId
- });
+ await deleteOrgRole({
+ orgId,
+ id: roleId
+ });
- createNotification({
- text: "Successfully deleted organization role",
- type: "success"
- });
+ createNotification({
+ text: "Successfully deleted organization role",
+ type: "success"
+ });
- handlePopUpClose("deleteOrgRole");
- navigate({
- to: "/organization/access-management" as const,
- search: {
- selectedTab: OrgAccessControlTabSections.Roles
- }
- });
- } catch (err) {
- console.error(err);
- const error = err as any;
- const text = error?.response?.data?.message ?? "Failed to delete organization role";
-
- createNotification({
- text,
- type: "error"
- });
- }
+ handlePopUpClose("deleteOrgRole");
+ navigate({
+ to: "/organization/access-management" as const,
+ search: {
+ selectedTab: OrgAccessControlTabSections.Roles
+ }
+ });
};
const isCustomRole = !["admin", "member", "no-access"].includes(data?.slug ?? "");
diff --git a/frontend/src/pages/organization/RoleByIDPage/components/RoleModal.tsx b/frontend/src/pages/organization/RoleByIDPage/components/RoleModal.tsx
index 88f568c4a7..73da4f1617 100644
--- a/frontend/src/pages/organization/RoleByIDPage/components/RoleModal.tsx
+++ b/frontend/src/pages/organization/RoleByIDPage/components/RoleModal.tsx
@@ -70,55 +70,46 @@ export const RoleModal = ({ popUp, handlePopUpToggle }: Props) => {
}, [role]);
const onFormSubmit = async ({ name, description, slug }: FormData) => {
- try {
- if (!orgId) return;
-
- if (role) {
- // update
-
- await updateOrgRole({
- orgId,
- id: role.id,
- name,
- description,
- slug
- });
-
- handlePopUpToggle("role", false);
- } else {
- // create
-
- const newRole = await createOrgRole({
- orgId,
- name,
- description,
- slug,
- permissions: []
- });
-
- handlePopUpToggle("role", false);
- navigate({
- to: "/organization/roles/$roleId",
- params: {
- roleId: newRole.id
- }
- });
- }
-
- createNotification({
- text: `Successfully ${popUp?.role?.data ? "updated" : "created"} role`,
- type: "success"
+ if (!orgId) return;
+
+ if (role) {
+ // update
+
+ await updateOrgRole({
+ orgId,
+ id: role.id,
+ name,
+ description,
+ slug
});
- reset();
- } catch {
- const text = `Failed to ${popUp?.role?.data ? "update" : "create"} role`;
+ handlePopUpToggle("role", false);
+ } else {
+ // create
+
+ const newRole = await createOrgRole({
+ orgId,
+ name,
+ description,
+ slug,
+ permissions: []
+ });
- createNotification({
- text,
- type: "error"
+ handlePopUpToggle("role", false);
+ navigate({
+ to: "/organization/roles/$roleId",
+ params: {
+ roleId: newRole.id
+ }
});
}
+
+ createNotification({
+ text: `Successfully ${popUp?.role?.data ? "updated" : "created"} role`,
+ type: "success"
+ });
+
+ reset();
};
return (
diff --git a/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RequestSecretForm.tsx b/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RequestSecretForm.tsx
index 50a9e0f583..d508733393 100644
--- a/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RequestSecretForm.tsx
+++ b/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RequestSecretForm.tsx
@@ -56,35 +56,27 @@ export const RequestSecretForm = () => {
const onFormSubmit = async ({ name, accessType, expiresIn }: FormData) => {
const expiresAt = new Date(new Date().getTime() + Number(expiresIn));
- try {
- const { id } = await createSecretRequest({
- name,
- accessType,
- expiresAt
- });
-
- const link = new URL(`${window.location.origin}/secret-request/secret/${id}`);
- if (subOrganization) {
- link.searchParams.set("subOrganization", subOrganization);
- }
-
- setSecretLink(link.toString());
- reset();
-
- navigator.clipboard.writeText(link.toString());
- setCopyTextSecret("secret");
-
- createNotification({
- text: "Shared secret link copied to clipboard.",
- type: "success"
- });
- } catch (error) {
- console.error(error);
- createNotification({
- text: "Failed to create a shared secret.",
- type: "error"
- });
+ const { id } = await createSecretRequest({
+ name,
+ accessType,
+ expiresAt
+ });
+
+ const link = new URL(`${window.location.origin}/secret-request/secret/${id}`);
+ if (subOrganization) {
+ link.searchParams.set("subOrganization", subOrganization);
}
+
+ setSecretLink(link.toString());
+ reset();
+
+ navigator.clipboard.writeText(link.toString());
+ setCopyTextSecret("secret");
+
+ createNotification({
+ text: "Shared secret link copied to clipboard.",
+ type: "success"
+ });
};
const hasSecretLink = Boolean(secretLink);
diff --git a/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RequestSecretTab.tsx b/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RequestSecretTab.tsx
index fd3b1d5b56..1253cdbc06 100644
--- a/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RequestSecretTab.tsx
+++ b/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RequestSecretTab.tsx
@@ -22,23 +22,15 @@ export const RequestSecretTab = () => {
const { mutateAsync: deleteSecretRequest } = useDeleteSecretRequest();
const onDeleteApproved = async () => {
- try {
- await deleteSecretRequest({
- secretRequestId: popUp.deleteSecretRequestConfirmation.data?.id
- });
- createNotification({
- text: "Successfully deleted secret request",
- type: "success"
- });
+ await deleteSecretRequest({
+ secretRequestId: popUp.deleteSecretRequestConfirmation.data?.id
+ });
+ createNotification({
+ text: "Successfully deleted secret request",
+ type: "success"
+ });
- handlePopUpClose("deleteSecretRequestConfirmation");
- } catch (err) {
- console.error(err);
- createNotification({
- text: "Failed to delete shared secret",
- type: "error"
- });
- }
+ handlePopUpClose("deleteSecretRequestConfirmation");
};
return (
diff --git a/frontend/src/pages/organization/SecretSharingPage/components/SecretSharingSettings/OrgSecretShareLimitSection.tsx b/frontend/src/pages/organization/SecretSharingPage/components/SecretSharingSettings/OrgSecretShareLimitSection.tsx
index 034c7d8fef..d7c3373322 100644
--- a/frontend/src/pages/organization/SecretSharingPage/components/SecretSharingSettings/OrgSecretShareLimitSection.tsx
+++ b/frontend/src/pages/organization/SecretSharingPage/components/SecretSharingSettings/OrgSecretShareLimitSection.tsx
@@ -90,28 +90,21 @@ export const OrgSecretShareLimitSection = () => {
}, [currentOrg, reset]);
const handleFormSubmit = async (formData: TForm) => {
- try {
- const maxSharedSecretLifetimeSeconds =
- ms(`${formData.maxLifetimeValue}${formData.maxLifetimeUnit}`) / 1000;
+ const maxSharedSecretLifetimeSeconds =
+ ms(`${formData.maxLifetimeValue}${formData.maxLifetimeUnit}`) / 1000;
- await mutateAsync({
- orgId: currentOrg.id,
- maxSharedSecretViewLimit: formData.shouldLimitView ? Number(formData.maxViewLimit) : null,
- maxSharedSecretLifetime: maxSharedSecretLifetimeSeconds
- });
+ await mutateAsync({
+ orgId: currentOrg.id,
+ maxSharedSecretViewLimit: formData.shouldLimitView ? Number(formData.maxViewLimit) : null,
+ maxSharedSecretLifetime: maxSharedSecretLifetimeSeconds
+ });
- createNotification({
- text: "Successfully updated secret share limits",
- type: "success"
- });
+ createNotification({
+ text: "Successfully updated secret share limits",
+ type: "success"
+ });
- reset(formData);
- } catch {
- createNotification({
- text: "Failed to update secret share limits",
- type: "error"
- });
- }
+ reset(formData);
};
// Units for the dropdown with readable labels
diff --git a/frontend/src/pages/organization/SecretSharingPage/components/SecretSharingSettings/SecretSharingAllowShareToAnyone.tsx b/frontend/src/pages/organization/SecretSharingPage/components/SecretSharingSettings/SecretSharingAllowShareToAnyone.tsx
index 1ea62c187c..31b2221ce0 100644
--- a/frontend/src/pages/organization/SecretSharingPage/components/SecretSharingSettings/SecretSharingAllowShareToAnyone.tsx
+++ b/frontend/src/pages/organization/SecretSharingPage/components/SecretSharingSettings/SecretSharingAllowShareToAnyone.tsx
@@ -9,25 +9,17 @@ export const SecretSharingAllowShareToAnyone = () => {
const { mutateAsync } = useUpdateOrg();
const handleSecretSharingToggle = async (value: boolean) => {
- try {
- if (!currentOrg?.id) return;
+ if (!currentOrg?.id) return;
- await mutateAsync({
- orgId: currentOrg.id,
- allowSecretSharingOutsideOrganization: value
- });
+ await mutateAsync({
+ orgId: currentOrg.id,
+ allowSecretSharingOutsideOrganization: value
+ });
- createNotification({
- text: `Successfully ${value ? "enabled" : "disabled"} secret sharing to members outside of this organization`,
- type: "success"
- });
- } catch (err) {
- console.error(err);
- createNotification({
- text: (err as { response: { data: { message: string } } }).response.data.message,
- type: "error"
- });
- }
+ createNotification({
+ text: `Successfully ${value ? "enabled" : "disabled"} secret sharing to members outside of this organization`,
+ type: "success"
+ });
};
return (
diff --git a/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretTab.tsx b/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretTab.tsx
index d4f2f0a1f0..2ea61ca989 100644
--- a/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretTab.tsx
+++ b/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretTab.tsx
@@ -20,23 +20,15 @@ export const ShareSecretTab = () => {
const deleteSecretShare = useDeleteSharedSecret();
const onDeleteApproved = async () => {
- try {
- deleteSecretShare.mutateAsync({
- sharedSecretId: (popUp?.deleteSharedSecretConfirmation?.data as DeleteModalData)?.id
- });
- createNotification({
- text: "Successfully deleted shared secret",
- type: "success"
- });
-
- handlePopUpClose("deleteSharedSecretConfirmation");
- } catch (err) {
- console.error(err);
- createNotification({
- text: "Failed to delete shared secret",
- type: "error"
- });
- }
+ deleteSecretShare.mutateAsync({
+ sharedSecretId: (popUp?.deleteSharedSecretConfirmation?.data as DeleteModalData)?.id
+ });
+ createNotification({
+ text: "Successfully deleted shared secret",
+ type: "success"
+ });
+
+ handlePopUpClose("deleteSharedSecretConfirmation");
};
return (
diff --git a/frontend/src/pages/organization/SettingsPage/components/AuditLogStreamTab/AuditLogStreamForm/AuditLogStreamForm.tsx b/frontend/src/pages/organization/SettingsPage/components/AuditLogStreamTab/AuditLogStreamForm/AuditLogStreamForm.tsx
index f59ae23aa5..5ea16050a5 100644
--- a/frontend/src/pages/organization/SettingsPage/components/AuditLogStreamTab/AuditLogStreamForm/AuditLogStreamForm.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/AuditLogStreamTab/AuditLogStreamForm/AuditLogStreamForm.tsx
@@ -28,21 +28,12 @@ const CreateForm = ({ provider, onComplete }: CreateFormProps) => {
const onSubmit = async (
formData: DiscriminativePick<TAuditLogStream, "provider" | "credentials">
) => {
- try {
- const logStream = await createAuditLogStream.mutateAsync(formData);
- createNotification({
- text: `Successfully created ${providerName} Log Stream`,
- type: "success"
- });
- onComplete(logStream);
- } catch (err: any) {
- console.error(err);
- createNotification({
- title: `Failed to create ${providerName} Log Stream`,
- text: err.message,
- type: "error"
- });
- }
+ const logStream = await createAuditLogStream.mutateAsync(formData);
+ createNotification({
+ text: `Successfully created ${providerName} Log Stream`,
+ type: "success"
+ });
+ onComplete(logStream);
};
switch (provider) {
@@ -68,24 +59,15 @@ const UpdateForm = ({ auditLogStream, onComplete }: UpdateFormProps) => {
const onSubmit = async (
formData: DiscriminativePick<TAuditLogStream, "provider" | "credentials">
) => {
- try {
- const connection = await updateAuditLogStream.mutateAsync({
- auditLogStreamId: auditLogStream.id,
- ...formData
- });
- createNotification({
- text: `Successfully updated ${providerName} Log Stream`,
- type: "success"
- });
- onComplete(connection);
- } catch (err: any) {
- console.error(err);
- createNotification({
- title: `Failed to update ${providerName} Log Stream`,
- text: err.message,
- type: "error"
- });
- }
+ const connection = await updateAuditLogStream.mutateAsync({
+ auditLogStreamId: auditLogStream.id,
+ ...formData
+ });
+ createNotification({
+ text: `Successfully updated ${providerName} Log Stream`,
+ type: "success"
+ });
+ onComplete(connection);
};
switch (auditLogStream.provider) {
diff --git a/frontend/src/pages/organization/SettingsPage/components/AuditLogStreamTab/components/DeleteAuditLogStreamModal.tsx b/frontend/src/pages/organization/SettingsPage/components/AuditLogStreamTab/components/DeleteAuditLogStreamModal.tsx
index 1a65e6c67d..74eb19af3a 100644
--- a/frontend/src/pages/organization/SettingsPage/components/AuditLogStreamTab/components/DeleteAuditLogStreamModal.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/AuditLogStreamTab/components/DeleteAuditLogStreamModal.tsx
@@ -20,26 +20,17 @@ export const DeleteAuditLogStreamModal = ({ isOpen, onOpenChange, auditLogStream
const providerDetails = AUDIT_LOG_STREAM_PROVIDER_MAP[provider];
const handleDelete = async () => {
- try {
- await deleteAuditLogStream.mutateAsync({
- auditLogStreamId,
- provider
- });
-
- createNotification({
- text: `Successfully deleted ${providerDetails.name} stream`,
- type: "success"
- });
-
- onOpenChange(false);
- } catch (err) {
- console.error(err);
-
- createNotification({
- text: `Failed to delete ${providerDetails.name} stream`,
- type: "error"
- });
- }
+ await deleteAuditLogStream.mutateAsync({
+ auditLogStreamId,
+ provider
+ });
+
+ createNotification({
+ text: `Successfully deleted ${providerDetails.name} stream`,
+ type: "success"
+ });
+
+ onOpenChange(false);
};
return (
diff --git a/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/VaultConnectionSection.tsx b/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/VaultConnectionSection.tsx
index c91e9c24cf..e802e250b1 100644
--- a/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/VaultConnectionSection.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/VaultConnectionSection.tsx
@@ -54,21 +54,13 @@ export const VaultConnectionSection = () => {
const handleDeleteConfirm = async () => {
if (!configToDelete) return;
- try {
- await deleteConfig({ id: configToDelete.id });
- createNotification({
- type: "success",
- text: "Namespace configuration deleted successfully"
- });
- setIsDeleteModalOpen(false);
- setConfigToDelete(null);
- } catch (error) {
- console.error("Failed to delete namespace config:", error);
- createNotification({
- type: "error",
- text: "Failed to delete namespace configuration"
- });
- }
+ await deleteConfig({ id: configToDelete.id });
+ createNotification({
+ type: "success",
+ text: "Namespace configuration deleted successfully"
+ });
+ setIsDeleteModalOpen(false);
+ setConfigToDelete(null);
};
const getConnectionName = (connectionId: string | null) => {
diff --git a/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/VaultNamespaceConfigModal.tsx b/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/VaultNamespaceConfigModal.tsx
index 62fb78b489..f08aae204d 100644
--- a/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/VaultNamespaceConfigModal.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/VaultNamespaceConfigModal.tsx
@@ -74,36 +74,28 @@ export const VaultNamespaceConfigModal = ({ isOpen, onOpenChange, editConfig }:
}, [isOpen, editConfig, reset]);
const onFormSubmit = async (data: FormData) => {
- try {
- if (isEdit && editConfig) {
- await updateConfig({
- id: editConfig.id,
- namespace: data.namespace,
- connectionId: data.connectionId
- });
- createNotification({
- type: "success",
- text: "Namespace configuration updated successfully"
- });
- } else {
- await createConfig({
- namespace: data.namespace,
- connectionId: data.connectionId
- });
- createNotification({
- type: "success",
- text: "Namespace configuration created successfully"
- });
- }
- reset();
- onOpenChange(false);
- } catch (error) {
- console.error("Failed to save namespace config:", error);
+ if (isEdit && editConfig) {
+ await updateConfig({
+ id: editConfig.id,
+ namespace: data.namespace,
+ connectionId: data.connectionId
+ });
+ createNotification({
+ type: "success",
+ text: "Namespace configuration updated successfully"
+ });
+ } else {
+ await createConfig({
+ namespace: data.namespace,
+ connectionId: data.connectionId
+ });
createNotification({
- type: "error",
- text: `Failed to ${isEdit ? "update" : "create"} namespace configuration`
+ type: "success",
+ text: "Namespace configuration created successfully"
});
}
+ reset();
+ onOpenChange(false);
};
const handleClose = () => {
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgDeleteSection/OrgDeleteSection.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgDeleteSection/OrgDeleteSection.tsx
index 4dfe89f71f..6e5c0e1cb7 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgDeleteSection/OrgDeleteSection.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgDeleteSection/OrgDeleteSection.tsx
@@ -19,27 +19,19 @@ export const OrgDeleteSection = () => {
const { mutateAsync, isPending } = useDeleteOrgById();
const handleDeleteOrgSubmit = async () => {
- try {
- if (!currentOrg?.id) return;
+ if (!currentOrg?.id) return;
- await mutateAsync({
- organizationId: currentOrg?.id
- });
+ await mutateAsync({
+ organizationId: currentOrg?.id
+ });
- createNotification({
- text: "Successfully deleted organization",
- type: "success"
- });
+ createNotification({
+ text: "Successfully deleted organization",
+ type: "success"
+ });
- clearSession();
- navigate({ to: "/login" });
- } catch (err) {
- console.error(err);
- createNotification({
- text: "Failed to delete organization",
- type: "error"
- });
- }
+ clearSession();
+ navigate({ to: "/login" });
};
return (
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgEncryptionTab/OrgEncryptionTab.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgEncryptionTab/OrgEncryptionTab.tsx
index a0b09b5734..3fcf71e62e 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgEncryptionTab/OrgEncryptionTab.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgEncryptionTab/OrgEncryptionTab.tsx
@@ -51,18 +51,14 @@ export const OrgEncryptionTab = withPermission(
kmsId: string;
};
- try {
- await removeExternalKms(kmsId);
+ await removeExternalKms(kmsId);
- createNotification({
- text: "Successfully deleted external KMS",
- type: "success"
- });
+ createNotification({
+ text: "Successfully deleted external KMS",
+ type: "success"
+ });
- handlePopUpToggle("removeExternalKms", false);
- } catch (err) {
- console.error(err);
- }
+ handlePopUpToggle("removeExternalKms", false);
};
return (
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgIncidentContactsSection/AddOrgIncidentContactModal.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgIncidentContactsSection/AddOrgIncidentContactModal.tsx
index 84bb083ec7..125a3f3108 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgIncidentContactsSection/AddOrgIncidentContactModal.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgIncidentContactsSection/AddOrgIncidentContactModal.tsx
@@ -35,31 +35,23 @@ export const AddOrgIncidentContactModal = ({
const { mutateAsync, isPending } = useAddIncidentContact();
const onFormSubmit = async ({ email }: TAddContactForm) => {
- try {
- if (!currentOrg?.id) return;
+ if (!currentOrg?.id) return;
- await mutateAsync({
- orgId: currentOrg.id,
- email
- });
+ await mutateAsync({
+ orgId: currentOrg.id,
+ email
+ });
- createNotification({
- text: "Successfully added incident contact",
- type: "success"
- });
+ createNotification({
+ text: "Successfully added incident contact",
+ type: "success"
+ });
- if (serverDetails?.emailConfigured) {
- handlePopUpClose("addContact");
- }
-
- reset();
- } catch (err) {
- console.error(err);
- createNotification({
- text: "Failed to add incident contact",
- type: "error"
- });
+ if (serverDetails?.emailConfigured) {
+ handlePopUpClose("addContact");
}
+
+ reset();
};
return (
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgIncidentContactsSection/OrgIncidentContactsTable.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgIncidentContactsSection/OrgIncidentContactsTable.tsx
index d0723fdaf6..c16431b9c0 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgIncidentContactsSection/OrgIncidentContactsTable.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgIncidentContactsSection/OrgIncidentContactsTable.tsx
@@ -33,28 +33,20 @@ export const OrgIncidentContactsTable = () => {
const { mutateAsync } = useDeleteIncidentContact();
const onRemoveIncidentContact = async () => {
- try {
- const incidentContactId = (popUp?.removeContact?.data as { id: string })?.id;
+ const incidentContactId = (popUp?.removeContact?.data as { id: string })?.id;
- if (!currentOrg?.id) return;
- await mutateAsync({
- orgId: currentOrg.id,
- incidentContactId
- });
+ if (!currentOrg?.id) return;
+ await mutateAsync({
+ orgId: currentOrg.id,
+ incidentContactId
+ });
- createNotification({
- text: "Successfully removed incident contact",
- type: "success"
- });
+ createNotification({
+ text: "Successfully removed incident contact",
+ type: "success"
+ });
- handlePopUpClose("removeContact");
- } catch (err) {
- console.error(err);
- createNotification({
- text: "Failed to remove incident contact",
- type: "error"
- });
- }
+ handlePopUpClose("removeContact");
};
const filteredContacts = contacts
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgNameChangeSection/OrgNameChangeSection.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgNameChangeSection/OrgNameChangeSection.tsx
index 766a221588..03fb14dc79 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgNameChangeSection/OrgNameChangeSection.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgNameChangeSection/OrgNameChangeSection.tsx
@@ -56,27 +56,19 @@ export const OrgNameChangeSection = (): JSX.Element => {
}, [roles]);
const onFormSubmit = async ({ name, slug, defaultMembershipRole }: FormData) => {
- try {
- if (!currentOrg?.id || !roles?.length) return;
+ if (!currentOrg?.id || !roles?.length) return;
- await mutateAsync({
- orgId: currentOrg?.id,
- name,
- slug,
- defaultMembershipRoleSlug: defaultMembershipRole
- });
+ await mutateAsync({
+ orgId: currentOrg?.id,
+ name,
+ slug,
+ defaultMembershipRoleSlug: defaultMembershipRole
+ });
- createNotification({
- text: "Successfully updated organization details",
- type: "success"
- });
- } catch (error) {
- console.error(error);
- createNotification({
- text: "Failed to update organization details",
- type: "error"
- });
- }
+ createNotification({
+ text: "Successfully updated organization details",
+ type: "success"
+ });
};
if (!isFormInitialized) {
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgNameChangeSection/SubOrgNameChangeSection.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgNameChangeSection/SubOrgNameChangeSection.tsx
index ca625be6cd..e08d4d1b51 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgNameChangeSection/SubOrgNameChangeSection.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgNameChangeSection/SubOrgNameChangeSection.tsx
@@ -39,26 +39,18 @@ export const SubOrgNameChangeSection = (): JSX.Element => {
const { mutateAsync, isPending } = useUpdateSubOrganization();
const onFormSubmit = async ({ name }: FormData) => {
- try {
- await mutateAsync({
- name,
- subOrgId: currentOrg.id
- });
+ await mutateAsync({
+ name,
+ subOrgId: currentOrg.id
+ });
- navigate({ to: "/organization/settings", search: { subOrganization: name } });
- queryClient.invalidateQueries();
- await router.invalidate({ sync: true });
- createNotification({
- text: "Successfully updated sub-organization details",
- type: "success"
- });
- } catch (error) {
- console.error(error);
- createNotification({
- text: "Failed to update sub-organization details",
- type: "error"
- });
- }
+ navigate({ to: "/organization/settings", search: { subOrganization: name } });
+ queryClient.invalidateQueries();
+ await router.invalidate({ sync: true });
+ createNotification({
+ text: "Successfully updated sub-organization details",
+ type: "success"
+ });
};
return (
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgProductSelectSection/OrgProductSelectSection.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgProductSelectSection/OrgProductSelectSection.tsx
index 5be15edadb..e1fc2712d8 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgProductSelectSection/OrgProductSelectSection.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgProductSelectSection/OrgProductSelectSection.tsx
@@ -1,7 +1,5 @@
import { useEffect, useState } from "react";
-import axios from "axios";
-import { createNotification } from "@app/components/notifications";
import { Switch } from "@app/components/v2";
import { useOrganization } from "@app/context";
import { useUpdateOrg } from "@app/hooks/api";
@@ -60,20 +58,10 @@ export const OrgProductSelectSection = () => {
[key]: { ...products[key], enabled: value }
}));
- try {
- await mutateAsync({
- orgId: currentOrg.id,
- [key]: value
- });
- } catch (e) {
- if (axios.isAxiosError(e)) {
- const { message = "Something went wrong" } = e.response?.data as { message: string };
- createNotification({
- type: "error",
- text: message
- });
- }
- }
+ await mutateAsync({
+ orgId: currentOrg.id,
+ [key]: value
+ });
setIsLoading(false);
};
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgProductSettingsTab/OrgProductSettingsTab.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgProductSettingsTab/OrgProductSettingsTab.tsx
index e4d9359968..95cc7b8701 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgProductSettingsTab/OrgProductSettingsTab.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgProductSettingsTab/OrgProductSettingsTab.tsx
@@ -30,12 +30,6 @@ export const OrgProductSettingsTab = () => {
text: `Successfully ${state ? "enabled" : "disabled"} blocking duplicate secret sync destinations for this organization`,
type: "success"
});
- } catch (err) {
- console.error(err);
- createNotification({
- text: "Failed to update blocking duplicate secret sync destinations setting for this organization",
- type: "error"
- });
} finally {
setIsLoading(false);
}
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgProvisioningTab/ExternalGroupOrgRoleMappings.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgProvisioningTab/ExternalGroupOrgRoleMappings.tsx
index 8e181e8c46..bc9a029211 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgProvisioningTab/ExternalGroupOrgRoleMappings.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgProvisioningTab/ExternalGroupOrgRoleMappings.tsx
@@ -75,19 +75,11 @@ export const ExternalGroupOrgRoleMappings = () => {
const mappingField = useFieldArray({ control, name: "mappings" });
const handleUpdateMappings = async (form: TForm) => {
- try {
- await updateMappings.mutateAsync(form);
- createNotification({
- text: "Group organization role mappings updated.",
- type: "success"
- });
- } catch (e) {
- console.error(e);
- createNotification({
- text: "Failed to update group organization role mappings.",
- type: "error"
- });
- }
+ await updateMappings.mutateAsync(form);
+ createNotification({
+ text: "Group organization role mappings updated.",
+ type: "success"
+ });
};
const disableScimEdit = permission.cannot(OrgPermissionActions.Edit, OrgPermissionSubjects.Scim);
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/LDAPModal.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/LDAPModal.tsx
index 580ecdeb10..b9ba7a2b68 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/LDAPModal.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/LDAPModal.tsx
@@ -122,53 +122,45 @@ export const LDAPModal = ({ popUp, handlePopUpClose, handlePopUpToggle, hideDele
caCert,
shouldCloseModal = true
}: TLDAPFormData & { shouldCloseModal?: boolean }) => {
- try {
- if (!currentOrg) return;
-
- if (!data) {
- await createMutateAsync({
- organizationId: currentOrg.id,
- isActive: false,
- url,
- bindDN,
- bindPass,
- searchBase,
- searchFilter,
- uniqueUserAttribute,
- groupSearchBase,
- groupSearchFilter,
- caCert
- });
- } else {
- await updateMutateAsync({
- organizationId: currentOrg.id,
- url,
- bindDN,
- bindPass,
- searchBase,
- searchFilter,
- uniqueUserAttribute,
- groupSearchBase,
- groupSearchFilter,
- caCert
- });
- }
+ if (!currentOrg) return;
- if (shouldCloseModal) {
- handlePopUpClose("addLDAP");
- }
-
- createNotification({
- text: `Successfully ${!data ? "added" : "updated"} LDAP configuration`,
- type: "success"
+ if (!data) {
+ await createMutateAsync({
+ organizationId: currentOrg.id,
+ isActive: false,
+ url,
+ bindDN,
+ bindPass,
+ searchBase,
+ searchFilter,
+ uniqueUserAttribute,
+ groupSearchBase,
+ groupSearchFilter,
+ caCert
});
- } catch (err) {
- console.error(err);
- createNotification({
- text: `Failed to ${!data ? "add" : "update"} LDAP configuration`,
- type: "error"
+ } else {
+ await updateMutateAsync({
+ organizationId: currentOrg.id,
+ url,
+ bindDN,
+ bindPass,
+ searchBase,
+ searchFilter,
+ uniqueUserAttribute,
+ groupSearchBase,
+ groupSearchFilter,
+ caCert
});
}
+
+ if (shouldCloseModal) {
+ handlePopUpClose("addLDAP");
+ }
+
+ createNotification({
+ text: `Successfully ${!data ? "added" : "updated"} LDAP configuration`,
+ type: "success"
+ });
};
const handleTestLDAPConnection = async () => {
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OIDCModal.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OIDCModal.tsx
index 03f946aced..f980b2e4ff 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OIDCModal.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OIDCModal.tsx
@@ -122,31 +122,24 @@ export const OIDCModal = ({ popUp, handlePopUpClose, handlePopUpToggle, hideDele
if (!currentOrg) {
return;
}
- try {
- await updateMutateAsync({
- issuer: "",
- discoveryURL: "",
- authorizationEndpoint: "",
- allowedEmailDomains: "",
- jwksUri: "",
- tokenEndpoint: "",
- userinfoEndpoint: "",
- clientId: "",
- clientSecret: "",
- isActive: false,
- organizationId: currentOrg.id
- });
+ await updateMutateAsync({
+ issuer: "",
+ discoveryURL: "",
+ authorizationEndpoint: "",
+ allowedEmailDomains: "",
+ jwksUri: "",
+ tokenEndpoint: "",
+ userinfoEndpoint: "",
+ clientId: "",
+ clientSecret: "",
+ isActive: false,
+ organizationId: currentOrg.id
+ });
- createNotification({
- text: "Successfully deleted OIDC configuration.",
- type: "success"
- });
- } catch {
- createNotification({
- text: "Failed deleting OIDC configuration.",
- type: "error"
- });
- }
+ createNotification({
+ text: "Successfully deleted OIDC configuration.",
+ type: "success"
+ });
};
useEffect(() => {
@@ -178,58 +171,50 @@ export const OIDCModal = ({ popUp, handlePopUpClose, handlePopUpToggle, hideDele
clientSecret,
jwtSignatureAlgorithm
}: OIDCFormData) => {
- try {
- if (!currentOrg) {
- return;
- }
-
- if (!data) {
- await createMutateAsync({
- issuer,
- configurationType,
- discoveryURL,
- authorizationEndpoint,
- allowedEmailDomains,
- jwksUri,
- tokenEndpoint,
- userinfoEndpoint,
- clientId,
- clientSecret,
- isActive: true,
- organizationId: currentOrg.id,
- jwtSignatureAlgorithm
- });
- } else {
- await updateMutateAsync({
- issuer,
- configurationType,
- discoveryURL,
- authorizationEndpoint,
- allowedEmailDomains,
- jwksUri,
- tokenEndpoint,
- userinfoEndpoint,
- clientId,
- clientSecret,
- isActive: true,
- organizationId: currentOrg.id,
- jwtSignatureAlgorithm
- });
- }
-
- handlePopUpClose("addOIDC");
+ if (!currentOrg) {
+ return;
+ }
- createNotification({
- text: `Successfully ${!data ? "added" : "updated"} OIDC SSO configuration`,
- type: "success"
+ if (!data) {
+ await createMutateAsync({
+ issuer,
+ configurationType,
+ discoveryURL,
+ authorizationEndpoint,
+ allowedEmailDomains,
+ jwksUri,
+ tokenEndpoint,
+ userinfoEndpoint,
+ clientId,
+ clientSecret,
+ isActive: true,
+ organizationId: currentOrg.id,
+ jwtSignatureAlgorithm
});
- } catch (err) {
- console.error(err);
- createNotification({
- text: `Failed to ${!data ? "add" : "update"} OIDC SSO configuration`,
- type: "error"
+ } else {
+ await updateMutateAsync({
+ issuer,
+ configurationType,
+ discoveryURL,
+ authorizationEndpoint,
+ allowedEmailDomains,
+ jwksUri,
+ tokenEndpoint,
+ userinfoEndpoint,
+ clientId,
+ clientSecret,
+ isActive: true,
+ organizationId: currentOrg.id,
+ jwtSignatureAlgorithm
});
}
+
+ handlePopUpClose("addOIDC");
+
+ createNotification({
+ text: `Successfully ${!data ? "added" : "updated"} OIDC SSO configuration`,
+ type: "success"
+ });
};
return (
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/SSOModal.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/SSOModal.tsx
index df5fca59fb..558f37dcbf 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/SSOModal.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/SSOModal.tsx
@@ -108,64 +108,49 @@ export const SSOModal = ({ popUp, handlePopUpClose, handlePopUpToggle, hideDelet
if (!currentOrg) {
return;
}
- try {
- await updateMutateAsync({
- organizationId: currentOrg.id,
- isActive: false,
- entryPoint: "",
- issuer: "",
- cert: ""
- });
+ await updateMutateAsync({
+ organizationId: currentOrg.id,
+ isActive: false,
+ entryPoint: "",
+ issuer: "",
+ cert: ""
+ });
- createNotification({
- text: "Successfully deleted SAML SSO configuration.",
- type: "success"
- });
- } catch {
- createNotification({
- text: "Failed deleting SAML SSO configuration.",
- type: "error"
- });
- }
+ createNotification({
+ text: "Successfully deleted SAML SSO configuration.",
+ type: "success"
+ });
};
const onSSOModalSubmit = async ({ authProvider, entryPoint, issuer, cert }: AddSSOFormData) => {
- try {
- if (!currentOrg) return;
-
- if (!data) {
- await createMutateAsync({
- organizationId: currentOrg.id,
- authProvider,
- isActive: false,
- entryPoint,
- issuer,
- cert
- });
- } else {
- await updateMutateAsync({
- organizationId: currentOrg.id,
- authProvider,
- isActive: false,
- entryPoint,
- issuer,
- cert
- });
- }
+ if (!currentOrg) return;
- handlePopUpClose("addSSO");
-
- createNotification({
- text: `Successfully ${!data ? "added" : "updated"} SAML SSO configuration`,
- type: "success"
+ if (!data) {
+ await createMutateAsync({
+ organizationId: currentOrg.id,
+ authProvider,
+ isActive: false,
+ entryPoint,
+ issuer,
+ cert
});
- } catch (err) {
- console.error(err);
- createNotification({
- text: `Failed to ${!data ? "add" : "update"} SAML SSO configuration`,
- type: "error"
+ } else {
+ await updateMutateAsync({
+ organizationId: currentOrg.id,
+ authProvider,
+ isActive: false,
+ entryPoint,
+ issuer,
+ cert
});
}
+
+ handlePopUpClose("addSSO");
+
+ createNotification({
+ text: `Successfully ${!data ? "added" : "updated"} SAML SSO configuration`,
+ type: "success"
+ });
};
const renderLabels = (authProvider: string) => {
diff --git a/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupRoles.tsx b/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupRoles.tsx
index 188c2ba7d9..67e962cfc2 100644
--- a/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupRoles.tsx
+++ b/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupRoles.tsx
@@ -253,18 +253,14 @@ const GroupRolesForm = ({ projectRoles, roles, groupId, onClose }: FormProps) =>
};
});
- try {
- await updateGroupWorkspaceRole.mutateAsync({
- projectId: currentProject?.id || "",
- groupId,
- roles: selectedRoles
- });
- createNotification({ text: "Successfully updated group role", type: "success" });
- onClose();
- setSearchRoles("");
- } catch {
- createNotification({ text: "Failed to update group role", type: "error" });
- }
+ await updateGroupWorkspaceRole.mutateAsync({
+ projectId: currentProject?.id || "",
+ groupId,
+ roles: selectedRoles
+ });
+ createNotification({ text: "Successfully updated group role", type: "success" });
+ onClose();
+ setSearchRoles("");
};
return (
diff --git a/frontend/src/pages/project/AccessControlPage/components/ProjectRoleListTab/components/ProjectRoleList/ProjectRoleList.tsx b/frontend/src/pages/project/AccessControlPage/components/ProjectRoleListTab/components/ProjectRoleList/ProjectRoleList.tsx
index fca53fa062..eeb29725f4 100644
--- a/frontend/src/pages/project/AccessControlPage/components/ProjectRoleListTab/components/ProjectRoleList/ProjectRoleList.tsx
+++ b/frontend/src/pages/project/AccessControlPage/components/ProjectRoleListTab/components/ProjectRoleList/ProjectRoleList.tsx
@@ -77,17 +77,12 @@ export const ProjectRoleList = () => {
const handleRoleDelete = async () => {
const { id } = popUp?.deleteRole?.data as TProjectRole;
- try {
- await deleteRole({
- projectId,
- id
- });
- createNotification({ type: "success", text: "Successfully removed the role" });
- handlePopUpClose("deleteRole");
- } catch (err) {
- console.log(err);
- createNotification({ type: "error", text: "Failed to delete role" });
- }
+ await deleteRole({
+ projectId,
+ id
+ });
+ createNotification({ type: "success", text: "Successfully removed the role" });
+ handlePopUpClose("deleteRole");
};
const {
diff --git a/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityProjectAdditionalPrivilegeSection/IdentityProjectAdditionalPrivilegeModifySection.tsx b/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityProjectAdditionalPrivilegeSection/IdentityProjectAdditionalPrivilegeModifySection.tsx
index a5d74271c8..956c01d694 100644
--- a/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityProjectAdditionalPrivilegeSection/IdentityProjectAdditionalPrivilegeModifySection.tsx
+++ b/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityProjectAdditionalPrivilegeSection/IdentityProjectAdditionalPrivilegeModifySection.tsx
@@ -131,33 +131,28 @@ export const IdentityProjectAdditionalPrivilegeModifySection = ({
temporaryAccessStartTime: el.temporaryAccess.temporaryAccessStartTime
};
- try {
- if (isCreate) {
- await createIdentityProjectAdditionalPrivilege({
- permissions: formRolePermission2API(el.permissions),
- identityId,
- projectId,
- slug: el.slug || undefined,
- type: accessType
- });
- createNotification({ type: "success", text: "Successfully created privilege" });
- } else {
- if (!projectId || !privilegeDetails?.id) return;
- await updateIdentityProjectAdditionalPrivilege({
- privilegeId: privilegeDetails.id,
- permissions: formRolePermission2API(el.permissions),
- projectId,
- identityId,
- slug: el.slug || undefined,
- type: accessType
- });
- createNotification({ type: "success", text: "Successfully updated privilege" });
- }
- onGoBack();
- } catch (err) {
- console.log(err);
- createNotification({ type: "error", text: "Failed to update privilege" });
+ if (isCreate) {
+ await createIdentityProjectAdditionalPrivilege({
+ permissions: formRolePermission2API(el.permissions),
+ identityId,
+ projectId,
+ slug: el.slug || undefined,
+ type: accessType
+ });
+ createNotification({ type: "success", text: "Successfully created privilege" });
+ } else {
+ if (!projectId || !privilegeDetails?.id) return;
+ await updateIdentityProjectAdditionalPrivilege({
+ privilegeId: privilegeDetails.id,
+ permissions: formRolePermission2API(el.permissions),
+ projectId,
+ identityId,
+ slug: el.slug || undefined,
+ type: accessType
+ });
+ createNotification({ type: "success", text: "Successfully updated privilege" });
}
+ onGoBack();
};
const privilegeTemporaryAccess = form.watch("temporaryAccess");
diff --git a/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityProjectAdditionalPrivilegeSection/IdentityProjectAdditionalPrivilegeSection.tsx b/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityProjectAdditionalPrivilegeSection/IdentityProjectAdditionalPrivilegeSection.tsx
index f98f6ebf8c..431875b3ce 100644
--- a/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityProjectAdditionalPrivilegeSection/IdentityProjectAdditionalPrivilegeSection.tsx
+++ b/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityProjectAdditionalPrivilegeSection/IdentityProjectAdditionalPrivilegeSection.tsx
@@ -57,18 +57,13 @@ export const IdentityProjectAdditionalPrivilegeSection = ({ identityMembershipDe
const handlePrivilegeDelete = async () => {
const { id } = popUp?.deletePrivilege?.data as { id: string };
- try {
- await deletePrivilege({
- privilegeId: id,
- projectId,
- identityId
- });
- createNotification({ type: "success", text: "Successfully removed the privilege" });
- handlePopUpClose("deletePrivilege");
- } catch (err) {
- console.log(err);
- createNotification({ type: "error", text: "Failed to delete privilege" });
- }
+ await deletePrivilege({
+ privilegeId: id,
+ projectId,
+ identityId
+ });
+ createNotification({ type: "success", text: "Successfully removed the privilege" });
+ handlePopUpClose("deletePrivilege");
};
return (
diff --git a/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityRoleDetailsSection/IdentityRoleDetailsSection.tsx b/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityRoleDetailsSection/IdentityRoleDetailsSection.tsx
index 34b5229d68..dce6321210 100644
--- a/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityRoleDetailsSection/IdentityRoleDetailsSection.tsx
+++ b/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityRoleDetailsSection/IdentityRoleDetailsSection.tsx
@@ -50,42 +50,37 @@ export const IdentityRoleDetailsSection = ({
const handleRoleDelete = async () => {
const { id } = popUp?.deleteRole?.data as TProjectRole;
- try {
- const updatedRoles = identityMembershipDetails?.roles?.filter((el) => el.id !== id);
- await updateIdentityWorkspaceRole({
- projectId: currentProject?.id || "",
- identityId: identityMembershipDetails.identity.id,
- roles: updatedRoles.map(
- ({
- role,
- customRoleSlug,
- isTemporary,
- temporaryMode,
- temporaryRange,
- temporaryAccessStartTime,
- temporaryAccessEndTime
- }) => ({
- role: role === "custom" ? customRoleSlug : role,
- ...(isTemporary
- ? {
- isTemporary,
- temporaryMode,
- temporaryRange,
- temporaryAccessStartTime,
- temporaryAccessEndTime
- }
- : {
- isTemporary
- })
- })
- )
- });
- createNotification({ type: "success", text: "Successfully removed role" });
- handlePopUpClose("deleteRole");
- } catch (err) {
- console.log(err);
- createNotification({ type: "error", text: "Failed to delete role" });
- }
+ const updatedRoles = identityMembershipDetails?.roles?.filter((el) => el.id !== id);
+ await updateIdentityWorkspaceRole({
+ projectId: currentProject?.id || "",
+ identityId: identityMembershipDetails.identity.id,
+ roles: updatedRoles.map(
+ ({
+ role,
+ customRoleSlug,
+ isTemporary,
+ temporaryMode,
+ temporaryRange,
+ temporaryAccessStartTime,
+ temporaryAccessEndTime
+ }) => ({
+ role: role === "custom" ? customRoleSlug : role,
+ ...(isTemporary
+ ? {
+ isTemporary,
+ temporaryMode,
+ temporaryRange,
+ temporaryAccessStartTime,
+ temporaryAccessEndTime
+ }
+ : {
+ isTemporary
+ })
+ })
+ )
+ });
+ createNotification({ type: "success", text: "Successfully removed role" });
+ handlePopUpClose("deleteRole");
};
return (
diff --git a/frontend/src/pages/project/MemberDetailsByIDPage/components/MemberProjectAdditionalPrivilegeSection/MemberProjectAdditionalPrivilegeSection.tsx b/frontend/src/pages/project/MemberDetailsByIDPage/components/MemberProjectAdditionalPrivilegeSection/MemberProjectAdditionalPrivilegeSection.tsx
index 7094c9ca8c..28c3c9b5ff 100644
--- a/frontend/src/pages/project/MemberDetailsByIDPage/components/MemberProjectAdditionalPrivilegeSection/MemberProjectAdditionalPrivilegeSection.tsx
+++ b/frontend/src/pages/project/MemberDetailsByIDPage/components/MemberProjectAdditionalPrivilegeSection/MemberProjectAdditionalPrivilegeSection.tsx
@@ -60,17 +60,12 @@ export const MemberProjectAdditionalPrivilegeSection = ({ membershipDetails }: P
const handlePrivilegeDelete = async () => {
const { id } = popUp?.deletePrivilege?.data as { id: string };
- try {
- await deletePrivilege({
- privilegeId: id,
- projectMembershipId: membershipDetails.id
- });
- createNotification({ type: "success", text: "Successfully removed the privilege" });
- handlePopUpClose("deletePrivilege");
- } catch (err) {
- console.log(err);
- createNotification({ type: "error", text: "Failed to delete privilege" });
- }
+ await deletePrivilege({
+ privilegeId: id,
+ projectMembershipId: membershipDetails.id
+ });
+ createNotification({ type: "success", text: "Successfully removed the privilege" });
+ handlePopUpClose("deletePrivilege");
};
return (
diff --git a/frontend/src/pages/project/MemberDetailsByIDPage/components/MemberProjectAdditionalPrivilegeSection/MembershipProjectAdditionalPrivilegeModifySection.tsx b/frontend/src/pages/project/MemberDetailsByIDPage/components/MemberProjectAdditionalPrivilegeSection/MembershipProjectAdditionalPrivilegeModifySection.tsx
index 1a217a5094..bc5bd3a6f2 100644
--- a/frontend/src/pages/project/MemberDetailsByIDPage/components/MemberProjectAdditionalPrivilegeSection/MembershipProjectAdditionalPrivilegeModifySection.tsx
+++ b/frontend/src/pages/project/MemberDetailsByIDPage/components/MemberProjectAdditionalPrivilegeSection/MembershipProjectAdditionalPrivilegeModifySection.tsx
@@ -129,31 +129,26 @@ export const MembershipProjectAdditionalPrivilegeModifySection = ({
temporaryAccessStartTime: el.temporaryAccess.temporaryAccessStartTime
};
- try {
- if (isCreate) {
- await createUserProjectAdditionalPrivilege({
- permissions: formRolePermission2API(el.permissions),
- projectMembershipId,
- slug: el.slug || undefined,
- type: accessType
- });
- createNotification({ type: "success", text: "Successfully created privilege" });
- } else {
- if (!projectId || !privilegeDetails?.id) return;
- await updateUserProjectAdditionalPrivilege({
- privilegeId: privilegeDetails.id,
- permissions: formRolePermission2API(el.permissions),
- projectMembershipId,
- slug: el.slug || undefined,
- type: accessType
- });
- createNotification({ type: "success", text: "Successfully updated privilege" });
- }
- onGoBack();
- } catch (err) {
- console.log(err);
- createNotification({ type: "error", text: "Failed to update privilege" });
+ if (isCreate) {
+ await createUserProjectAdditionalPrivilege({
+ permissions: formRolePermission2API(el.permissions),
+ projectMembershipId,
+ slug: el.slug || undefined,
+ type: accessType
+ });
+ createNotification({ type: "success", text: "Successfully created privilege" });
+ } else {
+ if (!projectId || !privilegeDetails?.id) return;
+ await updateUserProjectAdditionalPrivilege({
+ privilegeId: privilegeDetails.id,
+ permissions: formRolePermission2API(el.permissions),
+ projectMembershipId,
+ slug: el.slug || undefined,
+ type: accessType
+ });
+ createNotification({ type: "success", text: "Successfully updated privilege" });
}
+ onGoBack();
};
const privilegeTemporaryAccess = form.watch("temporaryAccess");
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/RolePermissionsSection.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/RolePermissionsSection.tsx
index fd95d2659e..c93cea5346 100644
--- a/frontend/src/pages/project/RoleDetailsBySlugPage/components/RolePermissionsSection.tsx
+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/RolePermissionsSection.tsx
@@ -122,19 +122,14 @@ export const RolePermissionsSection = ({ roleSlug, isDisabled }: Props) => {
const { mutateAsync: updateRole } = useUpdateProjectRole();
const onSubmit = async (el: TFormSchema) => {
- try {
- if (!projectId || !role?.id) return;
- await updateRole({
- id: role?.id as string,
- projectId,
- ...el,
- permissions: formRolePermission2API(el.permissions)
- });
- createNotification({ type: "success", text: "Successfully updated role" });
- } catch (err) {
- console.log(err);
- createNotification({ type: "error", text: "Failed to update role" });
- }
+ if (!projectId || !role?.id) return;
+ await updateRole({
+ id: role?.id as string,
+ projectId,
+ ...el,
+ permissions: formRolePermission2API(el.permissions)
+ });
+ createNotification({ type: "success", text: "Successfully updated role" });
};
const isCustomRole = !Object.values(ProjectMembershipRole).includes(
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/BackfillSecretReferenceSection/BackfillSecretReferenceSection.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/BackfillSecretReferenceSection/BackfillSecretReferenceSection.tsx
index 26f5c7fc96..9350698dcf 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/BackfillSecretReferenceSection/BackfillSecretReferenceSection.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/BackfillSecretReferenceSection/BackfillSecretReferenceSection.tsx
@@ -13,12 +13,8 @@ export const BackfillSecretReferenceSecretion = () => {
const handleBackfill = async () => {
if (backfillSecretReferences.isPending) return;
- try {
- await backfillSecretReferences.mutateAsync({ projectId: currentProject.id || "" });
- createNotification({ text: "Successfully re-indexed secret references", type: "success" });
- } catch {
- createNotification({ text: "Failed to re-index secret references", type: "error" });
- }
+ await backfillSecretReferences.mutateAsync({ projectId: currentProject.id || "" });
+ createNotification({ text: "Successfully re-indexed secret references", type: "success" });
};
const isAdmin = hasProjectRole(ProjectMembershipRole.Admin);