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