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
@@ -35,7 +35,7 @@ export const redirectForProviderAuth = (integrationOption: TCloudIntegration) =>
// generate CSRF token for OAuth2 code-token exchange integrations
const state = crypto.randomBytes(16).toString("hex");
localStorage.setItem("latestCSRFToken", state);
let link = "";
switch (integrationOption.slug) {
case "azure-key-vault":
@@ -32,7 +32,7 @@ export const CloudIntegrationSection = ({
const isEmpty = !isLoading && !cloudIntegrations?.length;
const sortedCloudIntegrations = cloudIntegrations.sort((a, b) => a.name.localeCompare(b.name));
return (
<div>
<div className="m-4 mt-7 flex max-w-5xl flex-col items-start justify-between px-2 text-xl">
@@ -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 {