mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-10 08:28:52 +00:00
fix: remove unnecessary useEffect
This commit is contained in:
@@ -101,8 +101,6 @@ export const ShareSecretsRow = ({
|
|||||||
<p className="text-xs text-gray-500">{formatDate(row.expiresAt)}</p>
|
<p className="text-xs text-gray-500">{formatDate(row.expiresAt)}</p>
|
||||||
</Td>
|
</Td>
|
||||||
<Td>
|
<Td>
|
||||||
|
|
||||||
|
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
handlePopUpOpen("deleteSharedSecretConfirmation", {
|
handlePopUpOpen("deleteSharedSecretConfirmation", {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { useEffect, useState } from "react";
|
|
||||||
import { faKey } from "@fortawesome/free-solid-svg-icons";
|
import { faKey } from "@fortawesome/free-solid-svg-icons";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -12,7 +11,7 @@ import {
|
|||||||
THead,
|
THead,
|
||||||
Tr
|
Tr
|
||||||
} from "@app/components/v2";
|
} from "@app/components/v2";
|
||||||
import { TSharedSecret, useGetSharedSecrets } from "@app/hooks/api/secretSharing";
|
import { useGetSharedSecrets } from "@app/hooks/api/secretSharing";
|
||||||
import { UsePopUpState } from "@app/hooks/usePopUp";
|
import { UsePopUpState } from "@app/hooks/usePopUp";
|
||||||
|
|
||||||
import { ShareSecretsRow } from "./ShareSecretsRow";
|
import { ShareSecretsRow } from "./ShareSecretsRow";
|
||||||
@@ -31,19 +30,11 @@ type Props = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const ShareSecretsTable = ({ handlePopUpOpen }: Props) => {
|
export const ShareSecretsTable = ({ handlePopUpOpen }: Props) => {
|
||||||
const [tableData, setTableData] = useState<TSharedSecret[]>([]);
|
|
||||||
const { isLoading, data = [] } = useGetSharedSecrets();
|
const { isLoading, data = [] } = useGetSharedSecrets();
|
||||||
|
|
||||||
useEffect(() => {
|
let tableData = data.filter((secret) => !secret.expiresAt || new Date(secret.expiresAt) > new Date())
|
||||||
if (!isLoading) {
|
|
||||||
setTableData(data);
|
|
||||||
}
|
|
||||||
}, [isLoading, data]);
|
|
||||||
|
|
||||||
const handleSecretExpiration = () => {
|
const handleSecretExpiration = () => {
|
||||||
setTableData(
|
tableData = data.filter((secret) => !secret.expiresAt || new Date(secret.expiresAt) > new Date());
|
||||||
data.filter((secret) => !secret.expiresAt || new Date(secret.expiresAt) > new Date())
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user