Skip to content

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

update secret import create notif

Maidul Islamba2a03897f93
diff --git a/frontend/src/views/SecretMainPage/components/ActionBar/CreateSecretImportForm.tsx b/frontend/src/views/SecretMainPage/components/ActionBar/CreateSecretImportForm.tsx
index 1413d3bfea..9d8a3c9b01 100644
--- a/frontend/src/views/SecretMainPage/components/ActionBar/CreateSecretImportForm.tsx
+++ b/frontend/src/views/SecretMainPage/components/ActionBar/CreateSecretImportForm.tsx
@@ -1,5 +1,6 @@
import { Controller, useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
+import { AxiosError } from "axios";
import { z } from "zod";
import { useNotificationContext } from "@app/components/context/Notifications/NotificationProvider";
@@ -78,12 +79,20 @@ export const CreateSecretImportForm = ({
type: "success",
text: "Successfully linked"
});
- } catch (error) {
- console.log(error);
- createNotification({
- type: "error",
- text: "Failed to link secrets"
- });
+ } catch (err) {
+ console.error(err);
+ const axiosError = err as AxiosError
+ if (axiosError?.response?.status === 401) {
+ createNotification({
+ text: "You do not have access to the selected environment/path",
+ type: "error"
+ });
+ } else {
+ createNotification({
+ type: "error",
+ text: "Failed to link secrets"
+ });
+ }
}
};