Merge pull request #2311 from Infisical/daniel/read-secrets-notification-removal

Fix: Remove notification when unable to read secrets from environment
This commit is contained in:
Daniel Hougaard
2024-08-20 21:56:41 +04:00
committed by GitHub
2 changed files with 9 additions and 5 deletions

View File

@@ -0,0 +1 @@
export const ERROR_NOT_ALLOWED_READ_SECRETS = "You are not allowed to read on secrets";

View File

@@ -7,6 +7,7 @@ import { createNotification } from "@app/components/notifications";
import { apiRequest } from "@app/config/request";
import { useToggle } from "@app/hooks/useToggle";
import { ERROR_NOT_ALLOWED_READ_SECRETS } from "./constants";
import {
GetSecretVersionsDTO,
SecretType,
@@ -135,11 +136,13 @@ export const useGetProjectSecretsAllEnv = ({
onError: (error: unknown) => {
if (axios.isAxiosError(error) && !isErrorHandled) {
const serverResponse = error.response?.data as { message: string };
createNotification({
title: "Error fetching secrets",
type: "error",
text: serverResponse.message
});
if (serverResponse.message !== ERROR_NOT_ALLOWED_READ_SECRETS) {
createNotification({
title: "Error fetching secrets",
type: "error",
text: serverResponse.message
});
}
setIsErrorHandled.on();
}