Fix IP whitelist PATCH endpoint, update localStorage project id to reflect navigated to project

This commit is contained in:
Tuan Dang
2023-07-26 17:46:33 +07:00
parent 7da6d72f13
commit 7ae6d1610f
7 changed files with 43 additions and 16 deletions
@@ -55,10 +55,16 @@ export const IPAllowlistModal = ({
});
useEffect(() => {
const trustedIpData = popUp?.trustedIp?.data as {
ipAddress: string;
comment: string;
prefix: number;
};
if (popUp?.trustedIp?.data) {
reset(popUp?.trustedIp?.data as {
ipAddress: string;
comment: string;
reset({
ipAddress: `${trustedIpData.ipAddress}${trustedIpData.prefix !== undefined ? `/${trustedIpData.prefix}` : ""}`,
comment: trustedIpData.comment
});
} else {
reset({
@@ -29,6 +29,7 @@ type Props = {
ipAddress?: string;
comment?: string;
isActive?: boolean;
prefix?: number;
},
) => void;
handlePopUpToggle: (popUpName: keyof UsePopUpState<["upgradePlan"]>, state?: boolean) => void;
@@ -103,6 +104,7 @@ export const IPAllowlistTable = ({
trustedIpId: _id,
ipAddress,
comment,
prefix,
isActive
});
} else {