mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
feat: upgrade react-query to v5 and changed hooks to staletime inf for prev context based ones
This commit is contained in:
@@ -27,7 +27,7 @@ export default function EnterEmailStep({
|
||||
setEmail,
|
||||
incrementStep
|
||||
}: DownloadBackupPDFStepProps): JSX.Element {
|
||||
const { mutateAsync, isLoading } = useSendVerificationEmail();
|
||||
const { mutateAsync, isPending } = useSendVerificationEmail();
|
||||
const [emailError, setEmailError] = useState(false);
|
||||
const { t } = useTranslation();
|
||||
|
||||
@@ -95,8 +95,8 @@ export default function EnterEmailStep({
|
||||
className="h-14"
|
||||
colorSchema="primary"
|
||||
variant="outline_bg"
|
||||
isLoading={isLoading}
|
||||
isDisabled={isLoading}
|
||||
isLoading={isPending}
|
||||
isDisabled={isPending}
|
||||
>
|
||||
{" "}
|
||||
{String(t("signup.step1-submit"))}{" "}
|
||||
|
||||
@@ -13,7 +13,7 @@ type Props = {
|
||||
export const UpgradePlanModal = ({ text, isOpen, onOpenChange }: Props): JSX.Element => {
|
||||
const { subscription } = useSubscription();
|
||||
const { currentOrg } = useOrganization();
|
||||
const { mutateAsync, isLoading } = useGetOrgTrialUrl();
|
||||
const { mutateAsync, isPending } = useGetOrgTrialUrl();
|
||||
const link =
|
||||
subscription && subscription.slug !== null
|
||||
? `/org/${currentOrg?.id}/billing`
|
||||
@@ -50,7 +50,7 @@ export const UpgradePlanModal = ({ text, isOpen, onOpenChange }: Props): JSX.Ele
|
||||
</p>
|
||||
<div className="mt-8 flex items-center">
|
||||
<Button
|
||||
isLoading={isLoading}
|
||||
isLoading={isPending}
|
||||
colorSchema="primary"
|
||||
onClick={handleUpgradeBtnClick}
|
||||
className="mr-4"
|
||||
|
||||
@@ -14,8 +14,8 @@ type Props = {
|
||||
};
|
||||
|
||||
const TotpRegistration = ({ onComplete, shouldCenterQr }: Props) => {
|
||||
const { data: registration, isLoading } = useGetUserTotpRegistration();
|
||||
const { mutateAsync: verifyUserTotp, isLoading: isVerifyLoading } =
|
||||
const { data: registration, isPending } = useGetUserTotpRegistration();
|
||||
const { mutateAsync: verifyUserTotp, isPending: isVerifyLoading } =
|
||||
useVerifyUserTotpRegistration();
|
||||
const [qrCodeUrl, setQrCodeUrl] = useState("");
|
||||
const [totp, setTotp] = useState("");
|
||||
@@ -47,7 +47,7 @@ const TotpRegistration = ({ onComplete, shouldCenterQr }: Props) => {
|
||||
generateQRCode();
|
||||
}, [registration]);
|
||||
|
||||
if (isLoading) {
|
||||
if (isPending) {
|
||||
return <ContentLoader />;
|
||||
}
|
||||
|
||||
|
||||
@@ -128,16 +128,13 @@ export default function NavHeader({
|
||||
<div className="flex items-center space-x-3">
|
||||
<FontAwesomeIcon icon={faAngleRight} className="ml-3 mr-1.5 text-xs text-gray-400" />
|
||||
<Link
|
||||
passHref
|
||||
legacyBehavior
|
||||
href={{
|
||||
pathname: "/project/[id]/secrets/[env]",
|
||||
to={{
|
||||
pathname: "/project/[id]/secrets/[env]" as const,
|
||||
query: { id: navigate.query.id, env: navigate.query.env }
|
||||
}}
|
||||
className="text-sm font-semibold text-primary/80 hover:text-primary"
|
||||
>
|
||||
<a className="text-sm font-semibold text-primary/80 hover:text-primary">
|
||||
{userAvailableEnvs?.find(({ slug }) => slug === currentEnv)?.name}
|
||||
</a>
|
||||
{userAvailableEnvs?.find(({ slug }) => slug === currentEnv)?.name}
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
import { useOrganization, useSubscription } from "@app/context";
|
||||
import { useGetOrgTrialUrl } from "@app/hooks/api";
|
||||
|
||||
import { Button } from "../Button";
|
||||
import { Modal, ModalContent } from "../Modal";
|
||||
|
||||
type Props = {
|
||||
isOpen?: boolean;
|
||||
onOpenChange?: (isOpen: boolean) => void;
|
||||
text: string;
|
||||
};
|
||||
|
||||
export const UpgradePlanModal = ({ text, isOpen, onOpenChange }: Props): JSX.Element => {
|
||||
const { subscription } = useSubscription();
|
||||
const { currentOrg } = useOrganization();
|
||||
const { mutateAsync, isLoading } = useGetOrgTrialUrl();
|
||||
const link =
|
||||
subscription && subscription.slug !== null
|
||||
? `/org/${currentOrg?.id}/billing`
|
||||
: "https://infisical.com/scheduledemo";
|
||||
|
||||
const handleUpgradeBtnClick = async () => {
|
||||
try {
|
||||
if (!subscription || !currentOrg) return;
|
||||
|
||||
if (!subscription.has_used_trial) {
|
||||
// direct user to start pro trial
|
||||
|
||||
const url = await mutateAsync({
|
||||
orgId: currentOrg.id,
|
||||
success_url: window.location.href
|
||||
});
|
||||
|
||||
window.location.href = url;
|
||||
} else {
|
||||
// direct user to upgrade their plan
|
||||
window.location.href = link;
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal isOpen={isOpen} onOpenChange={onOpenChange}>
|
||||
<ModalContent title="Unleash Infisical's Full Power">
|
||||
<p className="mb-2 text-bunker-300">{text}</p>
|
||||
<p className="text-bunker-300">
|
||||
Upgrade and get access to this, as well as to other powerful enhancements.
|
||||
</p>
|
||||
<div className="mt-8 flex items-center">
|
||||
<Button
|
||||
isLoading={isLoading}
|
||||
colorSchema="primary"
|
||||
onClick={handleUpgradeBtnClick}
|
||||
className="mr-4"
|
||||
>
|
||||
{subscription && !subscription.has_used_trial ? "Start Pro Free Trial" : "Upgrade Plan"}
|
||||
</Button>
|
||||
<Button
|
||||
colorSchema="secondary"
|
||||
variant="plain"
|
||||
onClick={() => onOpenChange && onOpenChange(false)}
|
||||
>
|
||||
Cancel
|
||||
</Button>
|
||||
</div>
|
||||
</ModalContent>
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
@@ -1 +0,0 @@
|
||||
export { UpgradePlanModal } from "./UpgradePlanModal";
|
||||
@@ -34,4 +34,3 @@ export * from "./Tabs";
|
||||
export * from "./Tag";
|
||||
export * from "./TextArea";
|
||||
export * from "./Tooltip";
|
||||
export * from "./UpgradePlanModal";
|
||||
|
||||
@@ -1,10 +1,32 @@
|
||||
import { createMongoAbility, MongoAbility, RawRuleOf } from "@casl/ability";
|
||||
import { unpackRules } from "@casl/ability/extra";
|
||||
import { useSuspenseQuery } from "@tanstack/react-query";
|
||||
import { useRouteContext } from "@tanstack/react-router";
|
||||
|
||||
import {
|
||||
conditionsMatcher,
|
||||
fetchUserOrgPermissions,
|
||||
roleQueryKeys
|
||||
} from "@app/hooks/api/roles/queries";
|
||||
|
||||
import { OrgPermissionSet } from "./types";
|
||||
|
||||
export const useOrgPermission = () => {
|
||||
const ctx = useRouteContext({
|
||||
const organizationId = useRouteContext({
|
||||
from: "/_authenticate/_org_details",
|
||||
select: (el) => el.orgPermission
|
||||
select: (el) => el.organizationId
|
||||
});
|
||||
|
||||
return ctx;
|
||||
const { data } = useSuspenseQuery({
|
||||
queryKey: roleQueryKeys.getUserOrgPermissions({ orgId: organizationId }),
|
||||
queryFn: () => fetchUserOrgPermissions({ orgId: organizationId }),
|
||||
select: (res) => {
|
||||
const rule = unpackRules<RawRuleOf<MongoAbility<OrgPermissionSet>>>(res.permissions);
|
||||
const ability = createMongoAbility<OrgPermissionSet>(rule, { conditionsMatcher });
|
||||
return { permission: ability, membership: res.membership };
|
||||
},
|
||||
staleTime: Infinity
|
||||
});
|
||||
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -1,9 +1,18 @@
|
||||
import { useSuspenseQuery } from "@tanstack/react-query";
|
||||
import { useRouteContext } from "@tanstack/react-router";
|
||||
|
||||
import { fetchOrganizationById, organizationKeys } from "@app/hooks/api/organization/queries";
|
||||
|
||||
export const useOrganization = () => {
|
||||
const currentOrg = useRouteContext({
|
||||
const organizationId = useRouteContext({
|
||||
from: "/_authenticate/_org_details",
|
||||
select: (el) => el.organization
|
||||
select: (el) => el.organizationId
|
||||
});
|
||||
|
||||
const { data: currentOrg } = useSuspenseQuery({
|
||||
queryKey: organizationKeys.getOrgById(organizationId),
|
||||
queryFn: () => fetchOrganizationById(organizationId),
|
||||
staleTime: Infinity
|
||||
});
|
||||
|
||||
return { currentOrg };
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import { adminQueryKeys, fetchServerConfig } from "@app/hooks/api/admin/queries";
|
||||
import { useSuspenseQuery } from "@tanstack/react-query";
|
||||
|
||||
import { adminQueryKeys, fetchServerConfig } from "@app/hooks/api/admin/queries";
|
||||
|
||||
export const useServerConfig = () => {
|
||||
const { data: config } = useSuspenseQuery({
|
||||
queryKey: adminQueryKeys.serverConfig(),
|
||||
queryFn: fetchServerConfig
|
||||
queryFn: fetchServerConfig,
|
||||
staleTime: Infinity
|
||||
});
|
||||
|
||||
return { config };
|
||||
|
||||
@@ -1,9 +1,18 @@
|
||||
import { useSuspenseQuery } from "@tanstack/react-query";
|
||||
import { useRouteContext } from "@tanstack/react-router";
|
||||
|
||||
import { fetchOrgSubscription, subscriptionQueryKeys } from "@app/hooks/api/subscriptions/queries";
|
||||
|
||||
export const useSubscription = () => {
|
||||
const subscription = useRouteContext({
|
||||
const organizationId = useRouteContext({
|
||||
from: "/_authenticate/_org_details",
|
||||
select: (el) => el.subscription
|
||||
select: (el) => el.organizationId
|
||||
});
|
||||
|
||||
const { data: subscription } = useSuspenseQuery({
|
||||
queryKey: subscriptionQueryKeys.getOrgSubsription(organizationId),
|
||||
queryFn: () => fetchOrgSubscription(organizationId),
|
||||
staleTime: Infinity
|
||||
});
|
||||
|
||||
return { subscription };
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
import { useRouteContext } from "@tanstack/react-router";
|
||||
import { useSuspenseQuery } from "@tanstack/react-query";
|
||||
|
||||
import { userKeys } from "@app/hooks/api";
|
||||
import { fetchUserDetails } from "@app/hooks/api/users/queries";
|
||||
|
||||
export const useUser = () => {
|
||||
const user = useRouteContext({ from: "/_authenticate", select: (el) => el.user })!;
|
||||
const { data: user } = useSuspenseQuery({
|
||||
queryKey: userKeys.getUser,
|
||||
queryFn: fetchUserDetails,
|
||||
staleTime: Infinity
|
||||
});
|
||||
|
||||
return { user };
|
||||
};
|
||||
|
||||
@@ -37,7 +37,9 @@ export const useCreateAccessApprovalPolicy = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { projectSlug }) => {
|
||||
queryClient.invalidateQueries(accessApprovalKeys.getAccessApprovalPolicies(projectSlug));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: accessApprovalKeys.getAccessApprovalPolicies(projectSlug)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -57,7 +59,9 @@ export const useUpdateAccessApprovalPolicy = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { projectSlug }) => {
|
||||
queryClient.invalidateQueries(accessApprovalKeys.getAccessApprovalPolicies(projectSlug));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: accessApprovalKeys.getAccessApprovalPolicies(projectSlug)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -71,7 +75,9 @@ export const useDeleteAccessApprovalPolicy = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { projectSlug }) => {
|
||||
queryClient.invalidateQueries(accessApprovalKeys.getAccessApprovalPolicies(projectSlug));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: accessApprovalKeys.getAccessApprovalPolicies(projectSlug)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -96,7 +102,9 @@ export const useCreateAccessRequest = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { projectSlug }) => {
|
||||
queryClient.invalidateQueries(accessApprovalKeys.getAccessApprovalRequestCount(projectSlug));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: accessApprovalKeys.getAccessApprovalRequestCount(projectSlug)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -124,10 +132,12 @@ export const useReviewAccessRequest = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { projectSlug, envSlug, requestedBy }) => {
|
||||
queryClient.invalidateQueries(
|
||||
accessApprovalKeys.getAccessApprovalRequests(projectSlug, envSlug, requestedBy)
|
||||
);
|
||||
queryClient.invalidateQueries(accessApprovalKeys.getAccessApprovalRequestCount(projectSlug));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: accessApprovalKeys.getAccessApprovalRequests(projectSlug, envSlug, requestedBy)
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: accessApprovalKeys.getAccessApprovalRequestCount(projectSlug)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { PackRule, unpackRules } from "@casl/ability/extra";
|
||||
import { useQuery, UseQueryOptions } from "@tanstack/react-query";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import { apiRequest } from "@app/config/request";
|
||||
import { TReactQueryOptions } from "@app/types/reactQuery";
|
||||
|
||||
import { TProjectPermission } from "../roles/types";
|
||||
import {
|
||||
@@ -41,15 +42,9 @@ export const useGetAccessPolicyApprovalCount = ({
|
||||
projectSlug,
|
||||
envSlug,
|
||||
options = {}
|
||||
}: TGetAccessPolicyApprovalCountDTO & {
|
||||
options?: UseQueryOptions<
|
||||
number,
|
||||
unknown,
|
||||
number,
|
||||
ReturnType<typeof accessApprovalKeys.getAccessApprovalPolicies>
|
||||
>;
|
||||
}) =>
|
||||
}: TGetAccessPolicyApprovalCountDTO & TReactQueryOptions) =>
|
||||
useQuery({
|
||||
queryKey: accessApprovalKeys.getAccessApprovalRequestCount(projectSlug),
|
||||
queryFn: () => fetchPolicyApprovalCount({ projectSlug, envSlug }),
|
||||
...options,
|
||||
enabled: Boolean(projectSlug) && (options?.enabled ?? true)
|
||||
@@ -99,14 +94,7 @@ const fetchAccessRequestsCount = async (projectSlug: string) => {
|
||||
export const useGetAccessRequestsCount = ({
|
||||
projectSlug,
|
||||
options = {}
|
||||
}: TGetAccessApprovalRequestsDTO & {
|
||||
options?: UseQueryOptions<
|
||||
TAccessRequestCount,
|
||||
unknown,
|
||||
{ pendingCount: number; finalizedCount: number },
|
||||
ReturnType<typeof accessApprovalKeys.getAccessApprovalRequestCount>
|
||||
>;
|
||||
}) =>
|
||||
}: TGetAccessApprovalRequestsDTO & TReactQueryOptions) =>
|
||||
useQuery({
|
||||
queryKey: accessApprovalKeys.getAccessApprovalRequestCount(projectSlug),
|
||||
queryFn: () => fetchAccessRequestsCount(projectSlug),
|
||||
@@ -119,14 +107,7 @@ export const useGetAccessApprovalPolicies = ({
|
||||
envSlug,
|
||||
authorProjectMembershipId,
|
||||
options = {}
|
||||
}: TGetAccessApprovalRequestsDTO & {
|
||||
options?: UseQueryOptions<
|
||||
TAccessApprovalPolicy[],
|
||||
unknown,
|
||||
TAccessApprovalPolicy[],
|
||||
ReturnType<typeof accessApprovalKeys.getAccessApprovalPolicies>
|
||||
>;
|
||||
}) =>
|
||||
}: TGetAccessApprovalRequestsDTO & TReactQueryOptions) =>
|
||||
useQuery({
|
||||
queryKey: accessApprovalKeys.getAccessApprovalPolicies(projectSlug),
|
||||
queryFn: () => fetchApprovalPolicies({ projectSlug, envSlug, authorProjectMembershipId }),
|
||||
@@ -139,14 +120,7 @@ export const useGetAccessApprovalRequests = ({
|
||||
envSlug,
|
||||
authorProjectMembershipId,
|
||||
options = {}
|
||||
}: TGetAccessApprovalRequestsDTO & {
|
||||
options?: UseQueryOptions<
|
||||
TAccessApprovalRequest[],
|
||||
unknown,
|
||||
TAccessApprovalRequest[],
|
||||
ReturnType<typeof accessApprovalKeys.getAccessApprovalRequests>
|
||||
>;
|
||||
}) =>
|
||||
}: TGetAccessApprovalRequestsDTO & TReactQueryOptions) =>
|
||||
useQuery({
|
||||
queryKey: accessApprovalKeys.getAccessApprovalRequests(
|
||||
projectSlug,
|
||||
|
||||
@@ -26,7 +26,7 @@ export const useCreateAdminUser = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries(adminQueryKeys.serverConfig());
|
||||
queryClient.invalidateQueries({ queryKey: adminQueryKeys.serverConfig() });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -48,8 +48,8 @@ export const useUpdateServerConfig = () => {
|
||||
},
|
||||
onSuccess: (data) => {
|
||||
queryClient.setQueryData(adminQueryKeys.serverConfig(), data);
|
||||
queryClient.invalidateQueries(adminQueryKeys.serverConfig());
|
||||
queryClient.invalidateQueries(organizationKeys.getUserOrganizations);
|
||||
queryClient.invalidateQueries({ queryKey: adminQueryKeys.serverConfig() });
|
||||
queryClient.invalidateQueries({ queryKey: organizationKeys.getUserOrganizations });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -82,7 +82,7 @@ export const useUpdateAdminSlackConfig = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries(adminQueryKeys.getAdminSlackConfig());
|
||||
queryClient.invalidateQueries({ queryKey: adminQueryKeys.getAdminSlackConfig() });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -94,7 +94,7 @@ export const useUpdateServerEncryptionStrategy = () => {
|
||||
await apiRequest.patch("/api/v1/admin/encryption-strategies", { strategy });
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries(adminQueryKeys.getServerEncryptionStrategies());
|
||||
queryClient.invalidateQueries({ queryKey: adminQueryKeys.getServerEncryptionStrategies() });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -48,6 +48,7 @@ export const useGetServerConfig = ({
|
||||
|
||||
export const useAdminGetUsers = (filters: AdminGetUsersFilters) => {
|
||||
return useInfiniteQuery({
|
||||
initialPageParam: 0,
|
||||
queryKey: adminQueryKeys.getUsers(filters),
|
||||
queryFn: async ({ pageParam }) => {
|
||||
const { data } = await apiRequest.get<{ users: User[] }>(
|
||||
|
||||
@@ -22,7 +22,7 @@ export const useCreateAPIKeyV2 = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries(userKeys.myAPIKeysV2);
|
||||
queryClient.invalidateQueries({ queryKey: userKeys.myAPIKeysV2 });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -39,7 +39,7 @@ export const useUpdateAPIKeyV2 = () => {
|
||||
return apiKeyData;
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries(userKeys.myAPIKeysV2);
|
||||
queryClient.invalidateQueries({ queryKey: userKeys.myAPIKeysV2 });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -54,7 +54,7 @@ export const useDeleteAPIKeyV2 = () => {
|
||||
return apiKeyData;
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries(userKeys.myAPIKeysV2);
|
||||
queryClient.invalidateQueries({ queryKey: userKeys.myAPIKeysV2 });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -22,7 +22,7 @@ export const useCreateAuditLogStream = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { orgId }) => {
|
||||
queryClient.invalidateQueries(auditLogStreamKeys.list(orgId));
|
||||
queryClient.invalidateQueries({ queryKey: auditLogStreamKeys.list(orgId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -39,7 +39,7 @@ export const useUpdateAuditLogStream = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { orgId }) => {
|
||||
queryClient.invalidateQueries(auditLogStreamKeys.list(orgId));
|
||||
queryClient.invalidateQueries({ queryKey: auditLogStreamKeys.list(orgId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -55,7 +55,7 @@ export const useDeleteAuditLogStream = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { orgId }) => {
|
||||
queryClient.invalidateQueries(auditLogStreamKeys.list(orgId));
|
||||
queryClient.invalidateQueries({ queryKey: auditLogStreamKeys.list(orgId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { useInfiniteQuery, UseInfiniteQueryOptions, useQuery } from "@tanstack/react-query";
|
||||
import { useInfiniteQuery, useQuery } from "@tanstack/react-query";
|
||||
import { AxiosError } from "axios";
|
||||
|
||||
import { createNotification } from "@app/components/notifications";
|
||||
import { apiRequest } from "@app/config/request";
|
||||
import { TReactQueryOptions } from "@app/types/reactQuery";
|
||||
|
||||
import { Actor, AuditLog, TGetAuditLogsFilter } from "./types";
|
||||
|
||||
@@ -16,18 +17,10 @@ export const auditLogKeys = {
|
||||
export const useGetAuditLogs = (
|
||||
filters: TGetAuditLogsFilter,
|
||||
projectId: string | null,
|
||||
options: Omit<
|
||||
UseInfiniteQueryOptions<
|
||||
AuditLog[],
|
||||
unknown,
|
||||
AuditLog[],
|
||||
AuditLog[],
|
||||
ReturnType<typeof auditLogKeys.getAuditLogs>
|
||||
>,
|
||||
"queryFn" | "queryKey" | "getNextPageParam"
|
||||
> = {}
|
||||
options: TReactQueryOptions["options"] = {}
|
||||
) => {
|
||||
return useInfiniteQuery({
|
||||
initialPageParam: 0,
|
||||
queryKey: auditLogKeys.getAuditLogs(projectId, filters),
|
||||
queryFn: async ({ pageParam }) => {
|
||||
try {
|
||||
|
||||
@@ -304,13 +304,14 @@ export const fetchAuthToken = async () => {
|
||||
const { data } = await apiRequest.post<GetAuthTokenAPI>("/api/v1/auth/token", undefined, {
|
||||
withCredentials: true
|
||||
});
|
||||
|
||||
setAuthToken(data.token);
|
||||
return data;
|
||||
};
|
||||
|
||||
export const useGetAuthToken = () =>
|
||||
useQuery(authKeys.getAuthToken, fetchAuthToken, {
|
||||
onSuccess: (data) => setAuthToken(data.token),
|
||||
useQuery({
|
||||
queryKey: authKeys.getAuthToken,
|
||||
queryFn: fetchAuthToken,
|
||||
retry: 0
|
||||
});
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ export const useUpdateBotActiveStatus = () => {
|
||||
});
|
||||
},
|
||||
onSuccess: (_, { workspaceId }) => {
|
||||
queryClient.invalidateQueries(queryKeys.getBot(workspaceId));
|
||||
queryClient.invalidateQueries({ queryKey: queryKeys.getBot(workspaceId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -29,7 +29,7 @@ export const useCreateCa = () => {
|
||||
return ca;
|
||||
},
|
||||
onSuccess: (_, { projectSlug }) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspaceCas({ projectSlug }));
|
||||
queryClient.invalidateQueries({ queryKey: workspaceKeys.getWorkspaceCas({ projectSlug }) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -44,8 +44,8 @@ export const useUpdateCa = () => {
|
||||
return ca;
|
||||
},
|
||||
onSuccess: ({ id }, { projectSlug }) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspaceCas({ projectSlug }));
|
||||
queryClient.invalidateQueries(caKeys.getCaById(id));
|
||||
queryClient.invalidateQueries({ queryKey: workspaceKeys.getWorkspaceCas({ projectSlug }) });
|
||||
queryClient.invalidateQueries({ queryKey: caKeys.getCaById(id) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -60,7 +60,7 @@ export const useDeleteCa = () => {
|
||||
return ca;
|
||||
},
|
||||
onSuccess: (_, { projectSlug }) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspaceCas({ projectSlug }));
|
||||
queryClient.invalidateQueries({ queryKey: workspaceKeys.getWorkspaceCas({ projectSlug }) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -89,9 +89,9 @@ export const useImportCaCertificate = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { caId, projectSlug }) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspaceCas({ projectSlug }));
|
||||
queryClient.invalidateQueries(caKeys.getCaCerts(caId));
|
||||
queryClient.invalidateQueries(caKeys.getCaCert(caId));
|
||||
queryClient.invalidateQueries({ queryKey: workspaceKeys.getWorkspaceCas({ projectSlug }) });
|
||||
queryClient.invalidateQueries({ queryKey: caKeys.getCaCerts(caId) });
|
||||
queryClient.invalidateQueries({ queryKey: caKeys.getCaCert(caId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -108,7 +108,9 @@ export const useCreateCertificate = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { projectSlug }) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.forWorkspaceCertificates(projectSlug));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: workspaceKeys.forWorkspaceCertificates(projectSlug)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -124,12 +126,12 @@ export const useRenewCa = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { caId, projectSlug }) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspaceCas({ projectSlug }));
|
||||
queryClient.invalidateQueries(caKeys.getCaById(caId));
|
||||
queryClient.invalidateQueries(caKeys.getCaCert(caId));
|
||||
queryClient.invalidateQueries(caKeys.getCaCerts(caId));
|
||||
queryClient.invalidateQueries(caKeys.getCaCsr(caId));
|
||||
queryClient.invalidateQueries(caKeys.getCaCrl(caId));
|
||||
queryClient.invalidateQueries({ queryKey: workspaceKeys.getWorkspaceCas({ projectSlug }) });
|
||||
queryClient.invalidateQueries({ queryKey: caKeys.getCaById(caId) });
|
||||
queryClient.invalidateQueries({ queryKey: caKeys.getCaCert(caId) });
|
||||
queryClient.invalidateQueries({ queryKey: caKeys.getCaCerts(caId) });
|
||||
queryClient.invalidateQueries({ queryKey: caKeys.getCaCsr(caId) });
|
||||
queryClient.invalidateQueries({ queryKey: caKeys.getCaCrl(caId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -25,8 +25,10 @@ export const useCreateCertTemplate = () => {
|
||||
return certificateTemplate;
|
||||
},
|
||||
onSuccess: ({ caId }, { projectId }) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspaceCertificateTemplates(projectId));
|
||||
queryClient.invalidateQueries(caKeys.getCaCertTemplates(caId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: workspaceKeys.getWorkspaceCertificateTemplates(projectId)
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: caKeys.getCaCertTemplates(caId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -43,9 +45,11 @@ export const useUpdateCertTemplate = () => {
|
||||
return certificateTemplate;
|
||||
},
|
||||
onSuccess: ({ caId }, { projectId, id }) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspaceCertificateTemplates(projectId));
|
||||
queryClient.invalidateQueries(certTemplateKeys.getCertTemplateById(id));
|
||||
queryClient.invalidateQueries(caKeys.getCaCertTemplates(caId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: workspaceKeys.getWorkspaceCertificateTemplates(projectId)
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: certTemplateKeys.getCertTemplateById(id) });
|
||||
queryClient.invalidateQueries({ queryKey: caKeys.getCaCertTemplates(caId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -60,9 +64,11 @@ export const useDeleteCertTemplate = () => {
|
||||
return certificateTemplate;
|
||||
},
|
||||
onSuccess: ({ caId }, { projectId, id }) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspaceCertificateTemplates(projectId));
|
||||
queryClient.invalidateQueries(certTemplateKeys.getCertTemplateById(id));
|
||||
queryClient.invalidateQueries(caKeys.getCaCertTemplates(caId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: workspaceKeys.getWorkspaceCertificateTemplates(projectId)
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: certTemplateKeys.getCertTemplateById(id) });
|
||||
queryClient.invalidateQueries({ queryKey: caKeys.getCaCertTemplates(caId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -78,7 +84,9 @@ export const useCreateEstConfig = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { certificateTemplateId }) => {
|
||||
queryClient.invalidateQueries(certTemplateKeys.getEstConfig(certificateTemplateId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: certTemplateKeys.getEstConfig(certificateTemplateId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -94,7 +102,9 @@ export const useUpdateEstConfig = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { certificateTemplateId }) => {
|
||||
queryClient.invalidateQueries(certTemplateKeys.getEstConfig(certificateTemplateId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: certTemplateKeys.getEstConfig(certificateTemplateId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -17,7 +17,9 @@ export const useDeleteCert = () => {
|
||||
return certificate;
|
||||
},
|
||||
onSuccess: (_, { projectSlug }) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.forWorkspaceCertificates(projectSlug));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: workspaceKeys.forWorkspaceCertificates(projectSlug)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -37,7 +39,9 @@ export const useRevokeCert = () => {
|
||||
return certificate;
|
||||
},
|
||||
onSuccess: (_, { projectSlug }) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.forWorkspaceCertificates(projectSlug));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: workspaceKeys.forWorkspaceCertificates(projectSlug)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -22,7 +22,7 @@ export const useCreateCmek = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { projectId }) => {
|
||||
queryClient.invalidateQueries(cmekKeys.getCmeksByProjectId({ projectId }));
|
||||
queryClient.invalidateQueries({ queryKey: cmekKeys.getCmeksByProjectId({ projectId }) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -40,7 +40,7 @@ export const useUpdateCmek = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { projectId }) => {
|
||||
queryClient.invalidateQueries(cmekKeys.getCmeksByProjectId({ projectId }));
|
||||
queryClient.invalidateQueries({ queryKey: cmekKeys.getCmeksByProjectId({ projectId }) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -54,7 +54,7 @@ export const useDeleteCmek = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { projectId }) => {
|
||||
queryClient.invalidateQueries(cmekKeys.getCmeksByProjectId({ projectId }));
|
||||
queryClient.invalidateQueries({ queryKey: cmekKeys.getCmeksByProjectId({ projectId }) });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -47,7 +47,7 @@ export const useGetCmeksByProjectId = (
|
||||
return data;
|
||||
},
|
||||
enabled: Boolean(projectId) && (options?.enabled ?? true),
|
||||
keepPreviousData: true,
|
||||
placeholderData: (previousData) => previousData,
|
||||
...options
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import { useCallback } from "react";
|
||||
import { useQuery, UseQueryOptions } from "@tanstack/react-query";
|
||||
import axios from "axios";
|
||||
|
||||
import { createNotification } from "@app/components/notifications";
|
||||
import { apiRequest } from "@app/config/request";
|
||||
import {
|
||||
DashboardProjectSecretsByKeys,
|
||||
@@ -175,26 +173,6 @@ export const useGetProjectSecretsOverview = (
|
||||
includeDynamicSecrets,
|
||||
environments
|
||||
}),
|
||||
onError: (error) => {
|
||||
if (axios.isAxiosError(error)) {
|
||||
const { message, requestId } = error.response?.data as {
|
||||
message: string;
|
||||
requestId: string;
|
||||
};
|
||||
createNotification({
|
||||
title: "Error fetching secret details",
|
||||
type: "error",
|
||||
text: message,
|
||||
copyActions: [
|
||||
{
|
||||
value: requestId,
|
||||
name: "Request ID",
|
||||
label: `Request ID: ${requestId}`
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
},
|
||||
select: useCallback((data: Awaited<ReturnType<typeof fetchProjectSecretsOverview>>) => {
|
||||
const { secrets, ...select } = data;
|
||||
const uniqueSecrets = secrets ? unique(secrets, (i) => i.secretKey) : [];
|
||||
@@ -213,7 +191,7 @@ export const useGetProjectSecretsOverview = (
|
||||
totalUniqueFoldersInPage: uniqueFolders.length
|
||||
};
|
||||
}, []),
|
||||
keepPreviousData: true
|
||||
placeholderData: (previousData) => previousData
|
||||
});
|
||||
};
|
||||
|
||||
@@ -278,26 +256,6 @@ export const useGetProjectSecretsDetails = (
|
||||
includeDynamicSecrets,
|
||||
tags
|
||||
}),
|
||||
onError: (error) => {
|
||||
if (axios.isAxiosError(error)) {
|
||||
const { message, requestId } = error.response?.data as {
|
||||
message: string;
|
||||
requestId: string;
|
||||
};
|
||||
createNotification({
|
||||
title: "Error fetching secret details",
|
||||
type: "error",
|
||||
text: message,
|
||||
copyActions: [
|
||||
{
|
||||
value: requestId,
|
||||
name: "Request ID",
|
||||
label: `Request ID: ${requestId}`
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
},
|
||||
select: useCallback(
|
||||
(data: Awaited<ReturnType<typeof fetchProjectSecretsDetails>>) => ({
|
||||
...data,
|
||||
@@ -305,7 +263,7 @@ export const useGetProjectSecretsDetails = (
|
||||
}),
|
||||
[]
|
||||
),
|
||||
keepPreviousData: true
|
||||
placeholderData: (previousData) => previousData
|
||||
});
|
||||
};
|
||||
|
||||
@@ -373,26 +331,6 @@ export const useGetProjectSecretsQuickSearch = (
|
||||
environments,
|
||||
tags
|
||||
}),
|
||||
onError: (error) => {
|
||||
if (axios.isAxiosError(error)) {
|
||||
const { message, requestId } = error.response?.data as {
|
||||
message: string;
|
||||
requestId: string;
|
||||
};
|
||||
createNotification({
|
||||
title: "Error fetching secrets deep search",
|
||||
type: "error",
|
||||
text: message,
|
||||
copyActions: [
|
||||
{
|
||||
value: requestId,
|
||||
name: "Request ID",
|
||||
label: `Request ID: ${requestId}`
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
},
|
||||
select: useCallback((data: Awaited<ReturnType<typeof fetchProjectSecretsQuickSearch>>) => {
|
||||
const { secrets, folders, dynamicSecrets } = data;
|
||||
|
||||
@@ -413,6 +351,6 @@ export const useGetProjectSecretsQuickSearch = (
|
||||
dynamicSecrets: groupedDynamicSecrets
|
||||
};
|
||||
}, []),
|
||||
keepPreviousData: true
|
||||
placeholderData: (previousData) => previousData
|
||||
});
|
||||
};
|
||||
|
||||
@@ -24,8 +24,10 @@ export const useCreateDynamicSecret = () => {
|
||||
},
|
||||
onSuccess: (_, { path, environmentSlug, projectSlug }) => {
|
||||
// TODO: optimize but we currently don't pass projectId
|
||||
queryClient.invalidateQueries(dashboardKeys.all());
|
||||
queryClient.invalidateQueries(dynamicSecretKeys.list({ path, projectSlug, environmentSlug }));
|
||||
queryClient.invalidateQueries({ queryKey: dashboardKeys.all() });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: dynamicSecretKeys.list({ path, projectSlug, environmentSlug })
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -43,8 +45,10 @@ export const useUpdateDynamicSecret = () => {
|
||||
},
|
||||
onSuccess: (_, { path, environmentSlug, projectSlug }) => {
|
||||
// TODO: optimize but currently don't pass projectId
|
||||
queryClient.invalidateQueries(dashboardKeys.all());
|
||||
queryClient.invalidateQueries(dynamicSecretKeys.list({ path, projectSlug, environmentSlug }));
|
||||
queryClient.invalidateQueries({ queryKey: dashboardKeys.all() });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: dynamicSecretKeys.list({ path, projectSlug, environmentSlug })
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -62,8 +66,10 @@ export const useDeleteDynamicSecret = () => {
|
||||
},
|
||||
onSuccess: (_, { path, environmentSlug, projectSlug }) => {
|
||||
// TODO: optimize but currently don't pass projectId
|
||||
queryClient.invalidateQueries(dashboardKeys.all());
|
||||
queryClient.invalidateQueries(dynamicSecretKeys.list({ path, projectSlug, environmentSlug }));
|
||||
queryClient.invalidateQueries({ queryKey: dashboardKeys.all() });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: dynamicSecretKeys.list({ path, projectSlug, environmentSlug })
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -26,9 +26,14 @@ export const useCreateDynamicSecretLease = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { path, environmentSlug, projectSlug, dynamicSecretName }) => {
|
||||
queryClient.invalidateQueries(
|
||||
dynamicSecretLeaseKeys.list({ path, projectSlug, environmentSlug, dynamicSecretName })
|
||||
);
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: dynamicSecretLeaseKeys.list({
|
||||
path,
|
||||
projectSlug,
|
||||
environmentSlug,
|
||||
dynamicSecretName
|
||||
})
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -45,9 +50,14 @@ export const useRenewDynamicSecretLease = () => {
|
||||
return data.lease;
|
||||
},
|
||||
onSuccess: (_, { path, environmentSlug, projectSlug, dynamicSecretName }) => {
|
||||
queryClient.invalidateQueries(
|
||||
dynamicSecretLeaseKeys.list({ path, projectSlug, environmentSlug, dynamicSecretName })
|
||||
);
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: dynamicSecretLeaseKeys.list({
|
||||
path,
|
||||
projectSlug,
|
||||
environmentSlug,
|
||||
dynamicSecretName
|
||||
})
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -64,9 +74,14 @@ export const useRevokeDynamicSecretLease = () => {
|
||||
return data.lease;
|
||||
},
|
||||
onSuccess: (_, { path, environmentSlug, projectSlug, dynamicSecretName }) => {
|
||||
queryClient.invalidateQueries(
|
||||
dynamicSecretLeaseKeys.list({ path, projectSlug, environmentSlug, dynamicSecretName })
|
||||
);
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: dynamicSecretLeaseKeys.list({
|
||||
path,
|
||||
projectSlug,
|
||||
environmentSlug,
|
||||
dynamicSecretName
|
||||
})
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -13,7 +13,7 @@ export const useUpdateExternalGroupOrgRoleMappings = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries(externalGroupOrgRoleMappingKeys.list());
|
||||
queryClient.invalidateQueries({ queryKey: externalGroupOrgRoleMappingKeys.list() });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -29,7 +29,7 @@ export const useCreateGroup = () => {
|
||||
return group;
|
||||
},
|
||||
onSuccess: (_, { organizationId }) => {
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgGroups(organizationId));
|
||||
queryClient.invalidateQueries({ queryKey: organizationKeys.getOrgGroups(organizationId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -57,8 +57,8 @@ export const useUpdateGroup = () => {
|
||||
return group;
|
||||
},
|
||||
onSuccess: ({ orgId, id: groupId }) => {
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgGroups(orgId));
|
||||
queryClient.invalidateQueries(groupKeys.getGroupById(groupId));
|
||||
queryClient.invalidateQueries({ queryKey: organizationKeys.getOrgGroups(orgId) });
|
||||
queryClient.invalidateQueries({ queryKey: groupKeys.getGroupById(groupId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -72,8 +72,8 @@ export const useDeleteGroup = () => {
|
||||
return group;
|
||||
},
|
||||
onSuccess: ({ orgId, id: groupId }) => {
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgGroups(orgId));
|
||||
queryClient.invalidateQueries(groupKeys.getGroupById(groupId));
|
||||
queryClient.invalidateQueries({ queryKey: organizationKeys.getOrgGroups(orgId) });
|
||||
queryClient.invalidateQueries({ queryKey: groupKeys.getGroupById(groupId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -94,7 +94,7 @@ export const useAddUserToGroup = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { slug }) => {
|
||||
queryClient.invalidateQueries(groupKeys.forGroupUserMemberships(slug));
|
||||
queryClient.invalidateQueries({ queryKey: groupKeys.forGroupUserMemberships(slug) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -117,8 +117,8 @@ export const useRemoveUserFromGroup = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { slug, username }) => {
|
||||
queryClient.invalidateQueries(groupKeys.forGroupUserMemberships(slug));
|
||||
queryClient.invalidateQueries(userKeys.listUserGroupMemberships(username));
|
||||
queryClient.invalidateQueries({ queryKey: groupKeys.forGroupUserMemberships(slug) });
|
||||
queryClient.invalidateQueries({ queryKey: userKeys.listUserGroupMemberships(username) });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -60,7 +60,7 @@ export const useListGroupUsers = ({
|
||||
filter
|
||||
}),
|
||||
enabled: Boolean(groupSlug),
|
||||
keepPreviousData: true,
|
||||
placeholderData: (previousData) => previousData,
|
||||
queryFn: async () => {
|
||||
const params = new URLSearchParams({
|
||||
offset: String(offset),
|
||||
|
||||
@@ -63,7 +63,9 @@ export const useCreateIdentity = () => {
|
||||
return identity;
|
||||
},
|
||||
onSuccess: (_, { organizationId }) => {
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgIdentityMemberships(organizationId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgIdentityMemberships(organizationId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -83,8 +85,10 @@ export const useUpdateIdentity = () => {
|
||||
return identity;
|
||||
},
|
||||
onSuccess: (_, { organizationId, identityId }) => {
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgIdentityMemberships(organizationId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityById(identityId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgIdentityMemberships(organizationId)
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityById(identityId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -99,7 +103,9 @@ export const useDeleteIdentity = () => {
|
||||
return identity;
|
||||
},
|
||||
onSuccess: (_, { organizationId }) => {
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgIdentityMemberships(organizationId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgIdentityMemberships(organizationId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -129,9 +135,13 @@ export const useAddIdentityUniversalAuth = () => {
|
||||
return identityUniversalAuth;
|
||||
},
|
||||
onSuccess: (_, { identityId, organizationId }) => {
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgIdentityMemberships(organizationId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityById(identityId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityUniversalAuth(identityId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgIdentityMemberships(organizationId)
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityById(identityId) });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: identitiesKeys.getIdentityUniversalAuth(identityId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -159,9 +169,13 @@ export const useUpdateIdentityUniversalAuth = () => {
|
||||
return identityUniversalAuth;
|
||||
},
|
||||
onSuccess: (_, { identityId, organizationId }) => {
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgIdentityMemberships(organizationId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityById(identityId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityUniversalAuth(identityId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgIdentityMemberships(organizationId)
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityById(identityId) });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: identitiesKeys.getIdentityUniversalAuth(identityId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -176,9 +190,13 @@ export const useDeleteIdentityUniversalAuth = () => {
|
||||
return identityUniversalAuth;
|
||||
},
|
||||
onSuccess: (_, { organizationId, identityId }) => {
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgIdentityMemberships(organizationId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityById(identityId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityUniversalAuth(identityId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgIdentityMemberships(organizationId)
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityById(identityId) });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: identitiesKeys.getIdentityUniversalAuth(identityId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -202,9 +220,9 @@ export const useCreateIdentityUniversalAuthClientSecret = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { identityId }) => {
|
||||
queryClient.invalidateQueries(
|
||||
identitiesKeys.getIdentityUniversalAuthClientSecrets(identityId)
|
||||
);
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: identitiesKeys.getIdentityUniversalAuthClientSecrets(identityId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -221,9 +239,9 @@ export const useRevokeIdentityUniversalAuthClientSecret = () => {
|
||||
return clientSecretData;
|
||||
},
|
||||
onSuccess: (_, { identityId }) => {
|
||||
queryClient.invalidateQueries(
|
||||
identitiesKeys.getIdentityUniversalAuthClientSecrets(identityId)
|
||||
);
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: identitiesKeys.getIdentityUniversalAuthClientSecrets(identityId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -261,9 +279,11 @@ export const useAddIdentityGcpAuth = () => {
|
||||
return identityGcpAuth;
|
||||
},
|
||||
onSuccess: (_, { identityId, organizationId }) => {
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgIdentityMemberships(organizationId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityById(identityId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityGcpAuth(identityId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgIdentityMemberships(organizationId)
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityById(identityId) });
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityGcpAuth(identityId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -301,9 +321,11 @@ export const useUpdateIdentityGcpAuth = () => {
|
||||
return identityGcpAuth;
|
||||
},
|
||||
onSuccess: (_, { identityId, organizationId }) => {
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgIdentityMemberships(organizationId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityById(identityId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityGcpAuth(identityId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgIdentityMemberships(organizationId)
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityById(identityId) });
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityGcpAuth(identityId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -318,9 +340,11 @@ export const useDeleteIdentityGcpAuth = () => {
|
||||
return identityGcpAuth;
|
||||
},
|
||||
onSuccess: (_, { organizationId, identityId }) => {
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgIdentityMemberships(organizationId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityById(identityId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityGcpAuth(identityId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgIdentityMemberships(organizationId)
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityById(identityId) });
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityGcpAuth(identityId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -356,9 +380,11 @@ export const useAddIdentityAwsAuth = () => {
|
||||
return identityAwsAuth;
|
||||
},
|
||||
onSuccess: (_, { identityId, organizationId }) => {
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgIdentityMemberships(organizationId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityById(identityId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityAwsAuth(identityId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgIdentityMemberships(organizationId)
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityById(identityId) });
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityAwsAuth(identityId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -394,9 +420,11 @@ export const useUpdateIdentityAwsAuth = () => {
|
||||
return identityAwsAuth;
|
||||
},
|
||||
onSuccess: (_, { identityId, organizationId }) => {
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgIdentityMemberships(organizationId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityById(identityId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityAwsAuth(identityId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgIdentityMemberships(organizationId)
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityById(identityId) });
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityAwsAuth(identityId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -411,9 +439,11 @@ export const useDeleteIdentityAwsAuth = () => {
|
||||
return identityAwsAuth;
|
||||
},
|
||||
onSuccess: (_, { organizationId, identityId }) => {
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgIdentityMemberships(organizationId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityById(identityId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityAwsAuth(identityId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgIdentityMemberships(organizationId)
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityById(identityId) });
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityAwsAuth(identityId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -455,9 +485,11 @@ export const useUpdateIdentityOidcAuth = () => {
|
||||
return identityOidcAuth;
|
||||
},
|
||||
onSuccess: (_, { identityId, organizationId }) => {
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgIdentityMemberships(organizationId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityById(identityId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityOidcAuth(identityId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgIdentityMemberships(organizationId)
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityById(identityId) });
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityOidcAuth(identityId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -499,9 +531,11 @@ export const useAddIdentityOidcAuth = () => {
|
||||
return identityOidcAuth;
|
||||
},
|
||||
onSuccess: (_, { identityId, organizationId }) => {
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgIdentityMemberships(organizationId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityById(identityId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityOidcAuth(identityId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgIdentityMemberships(organizationId)
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityById(identityId) });
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityOidcAuth(identityId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -516,9 +550,11 @@ export const useDeleteIdentityOidcAuth = () => {
|
||||
return identityOidcAuth;
|
||||
},
|
||||
onSuccess: (_, { organizationId, identityId }) => {
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgIdentityMemberships(organizationId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityById(identityId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityOidcAuth(identityId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgIdentityMemberships(organizationId)
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityById(identityId) });
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityOidcAuth(identityId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -563,9 +599,11 @@ export const useUpdateIdentityJwtAuth = () => {
|
||||
return identityJwtAuth;
|
||||
},
|
||||
onSuccess: (_, { identityId, organizationId }) => {
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgIdentityMemberships(organizationId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityById(identityId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityJwtAuth(identityId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgIdentityMemberships(organizationId)
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityById(identityId) });
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityJwtAuth(identityId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -611,9 +649,11 @@ export const useAddIdentityJwtAuth = () => {
|
||||
return identityJwtAuth;
|
||||
},
|
||||
onSuccess: (_, { identityId, organizationId }) => {
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgIdentityMemberships(organizationId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityById(identityId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityJwtAuth(identityId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgIdentityMemberships(organizationId)
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityById(identityId) });
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityJwtAuth(identityId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -628,9 +668,11 @@ export const useDeleteIdentityJwtAuth = () => {
|
||||
return identityJwtAuth;
|
||||
},
|
||||
onSuccess: (_, { organizationId, identityId }) => {
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgIdentityMemberships(organizationId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityById(identityId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityJwtAuth(identityId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgIdentityMemberships(organizationId)
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityById(identityId) });
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityJwtAuth(identityId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -666,9 +708,13 @@ export const useAddIdentityAzureAuth = () => {
|
||||
return identityAzureAuth;
|
||||
},
|
||||
onSuccess: (_, { identityId, organizationId }) => {
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgIdentityMemberships(organizationId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityById(identityId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityKubernetesAuth(identityId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgIdentityMemberships(organizationId)
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityById(identityId) });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: identitiesKeys.getIdentityKubernetesAuth(identityId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -710,9 +756,11 @@ export const useAddIdentityKubernetesAuth = () => {
|
||||
return identityKubernetesAuth;
|
||||
},
|
||||
onSuccess: (_, { identityId, organizationId }) => {
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgIdentityMemberships(organizationId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityById(identityId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityAzureAuth(identityId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgIdentityMemberships(organizationId)
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityById(identityId) });
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityAzureAuth(identityId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -748,9 +796,11 @@ export const useUpdateIdentityAzureAuth = () => {
|
||||
return identityAzureAuth;
|
||||
},
|
||||
onSuccess: (_, { identityId, organizationId }) => {
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgIdentityMemberships(organizationId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityById(identityId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityAzureAuth(identityId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgIdentityMemberships(organizationId)
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityById(identityId) });
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityAzureAuth(identityId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -765,9 +815,11 @@ export const useDeleteIdentityAzureAuth = () => {
|
||||
return identityAzureAuth;
|
||||
},
|
||||
onSuccess: (_, { organizationId, identityId }) => {
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgIdentityMemberships(organizationId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityById(identityId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityAzureAuth(identityId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgIdentityMemberships(organizationId)
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityById(identityId) });
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityAzureAuth(identityId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -809,9 +861,13 @@ export const useUpdateIdentityKubernetesAuth = () => {
|
||||
return identityKubernetesAuth;
|
||||
},
|
||||
onSuccess: (_, { identityId, organizationId }) => {
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgIdentityMemberships(organizationId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityById(identityId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityKubernetesAuth(identityId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgIdentityMemberships(organizationId)
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityById(identityId) });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: identitiesKeys.getIdentityKubernetesAuth(identityId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -826,9 +882,13 @@ export const useDeleteIdentityKubernetesAuth = () => {
|
||||
return identityKubernetesAuth;
|
||||
},
|
||||
onSuccess: (_, { organizationId, identityId }) => {
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgIdentityMemberships(organizationId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityById(identityId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityKubernetesAuth(identityId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgIdentityMemberships(organizationId)
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityById(identityId) });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: identitiesKeys.getIdentityKubernetesAuth(identityId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -858,9 +918,13 @@ export const useAddIdentityTokenAuth = () => {
|
||||
return identityTokenAuth;
|
||||
},
|
||||
onSuccess: (_, { identityId, organizationId }) => {
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgIdentityMemberships(organizationId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityById(identityId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityUniversalAuth(identityId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgIdentityMemberships(organizationId)
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityById(identityId) });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: identitiesKeys.getIdentityUniversalAuth(identityId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -890,9 +954,13 @@ export const useUpdateIdentityTokenAuth = () => {
|
||||
return identityTokenAuth;
|
||||
},
|
||||
onSuccess: (_, { identityId, organizationId }) => {
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgIdentityMemberships(organizationId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityById(identityId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityUniversalAuth(identityId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgIdentityMemberships(organizationId)
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityById(identityId) });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: identitiesKeys.getIdentityUniversalAuth(identityId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -907,9 +975,11 @@ export const useDeleteIdentityTokenAuth = () => {
|
||||
return identityTokenAuth;
|
||||
},
|
||||
onSuccess: (_, { organizationId, identityId }) => {
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgIdentityMemberships(organizationId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityById(identityId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityTokenAuth(identityId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgIdentityMemberships(organizationId)
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityById(identityId) });
|
||||
queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityTokenAuth(identityId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -928,7 +998,9 @@ export const useCreateTokenIdentityTokenAuth = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { identityId }) => {
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityTokensTokenAuth(identityId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: identitiesKeys.getIdentityTokensTokenAuth(identityId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -949,7 +1021,9 @@ export const useUpdateIdentityTokenAuthToken = () => {
|
||||
return token;
|
||||
},
|
||||
onSuccess: (_, { identityId }) => {
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityTokensTokenAuth(identityId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: identitiesKeys.getIdentityTokensTokenAuth(identityId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -965,7 +1039,9 @@ export const useRevokeIdentityTokenAuthToken = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { identityId }) => {
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityTokensTokenAuth(identityId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: identitiesKeys.getIdentityTokensTokenAuth(identityId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useQuery, UseQueryOptions } from "@tanstack/react-query";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import { apiRequest } from "@app/config/request";
|
||||
import { TReactQueryOptions } from "@app/types/reactQuery";
|
||||
|
||||
import {
|
||||
ClientSecretData,
|
||||
@@ -69,12 +70,7 @@ export const useGetIdentityProjectMemberships = (identityId: string) => {
|
||||
|
||||
export const useGetIdentityUniversalAuth = (
|
||||
identityId: string,
|
||||
options?: UseQueryOptions<
|
||||
IdentityUniversalAuth,
|
||||
unknown,
|
||||
IdentityUniversalAuth,
|
||||
ReturnType<typeof identitiesKeys.getIdentityUniversalAuth>
|
||||
>
|
||||
options?: TReactQueryOptions["options"]
|
||||
) => {
|
||||
return useQuery({
|
||||
queryKey: identitiesKeys.getIdentityUniversalAuth(identityId),
|
||||
@@ -86,7 +82,7 @@ export const useGetIdentityUniversalAuth = (
|
||||
);
|
||||
return identityUniversalAuth;
|
||||
},
|
||||
cacheTime: 0,
|
||||
gcTime: 0,
|
||||
staleTime: 0,
|
||||
...options,
|
||||
enabled: Boolean(identityId) && (options?.enabled ?? true)
|
||||
@@ -110,12 +106,7 @@ export const useGetIdentityUniversalAuthClientSecrets = (identityId: string) =>
|
||||
|
||||
export const useGetIdentityGcpAuth = (
|
||||
identityId: string,
|
||||
options?: UseQueryOptions<
|
||||
IdentityGcpAuth,
|
||||
unknown,
|
||||
IdentityGcpAuth,
|
||||
ReturnType<typeof identitiesKeys.getIdentityGcpAuth>
|
||||
>
|
||||
options?: TReactQueryOptions["options"]
|
||||
) => {
|
||||
return useQuery({
|
||||
queryKey: identitiesKeys.getIdentityGcpAuth(identityId),
|
||||
@@ -128,7 +119,7 @@ export const useGetIdentityGcpAuth = (
|
||||
return identityGcpAuth;
|
||||
},
|
||||
staleTime: 0,
|
||||
cacheTime: 0,
|
||||
gcTime: 0,
|
||||
...options,
|
||||
enabled: Boolean(identityId) && (options?.enabled ?? true)
|
||||
});
|
||||
@@ -136,12 +127,7 @@ export const useGetIdentityGcpAuth = (
|
||||
|
||||
export const useGetIdentityAwsAuth = (
|
||||
identityId: string,
|
||||
options?: UseQueryOptions<
|
||||
IdentityAwsAuth,
|
||||
unknown,
|
||||
IdentityAwsAuth,
|
||||
ReturnType<typeof identitiesKeys.getIdentityAwsAuth>
|
||||
>
|
||||
options?: TReactQueryOptions["options"]
|
||||
) => {
|
||||
return useQuery({
|
||||
queryKey: identitiesKeys.getIdentityAwsAuth(identityId),
|
||||
@@ -154,7 +140,7 @@ export const useGetIdentityAwsAuth = (
|
||||
return identityAwsAuth;
|
||||
},
|
||||
staleTime: 0,
|
||||
cacheTime: 0,
|
||||
gcTime: 0,
|
||||
...options,
|
||||
enabled: Boolean(identityId) && (options?.enabled ?? true)
|
||||
});
|
||||
@@ -162,12 +148,7 @@ export const useGetIdentityAwsAuth = (
|
||||
|
||||
export const useGetIdentityAzureAuth = (
|
||||
identityId: string,
|
||||
options?: UseQueryOptions<
|
||||
IdentityAzureAuth,
|
||||
unknown,
|
||||
IdentityAzureAuth,
|
||||
ReturnType<typeof identitiesKeys.getIdentityAzureAuth>
|
||||
>
|
||||
options?: TReactQueryOptions["options"]
|
||||
) => {
|
||||
return useQuery({
|
||||
queryKey: identitiesKeys.getIdentityAzureAuth(identityId),
|
||||
@@ -180,7 +161,7 @@ export const useGetIdentityAzureAuth = (
|
||||
return identityAzureAuth;
|
||||
},
|
||||
staleTime: 0,
|
||||
cacheTime: 0,
|
||||
gcTime: 0,
|
||||
...options,
|
||||
enabled: Boolean(identityId) && (options?.enabled ?? true)
|
||||
});
|
||||
@@ -188,12 +169,7 @@ export const useGetIdentityAzureAuth = (
|
||||
|
||||
export const useGetIdentityKubernetesAuth = (
|
||||
identityId: string,
|
||||
options?: UseQueryOptions<
|
||||
IdentityKubernetesAuth,
|
||||
unknown,
|
||||
IdentityKubernetesAuth,
|
||||
ReturnType<typeof identitiesKeys.getIdentityKubernetesAuth>
|
||||
>
|
||||
options?: TReactQueryOptions["options"]
|
||||
) => {
|
||||
return useQuery({
|
||||
queryKey: identitiesKeys.getIdentityKubernetesAuth(identityId),
|
||||
@@ -206,7 +182,7 @@ export const useGetIdentityKubernetesAuth = (
|
||||
return identityKubernetesAuth;
|
||||
},
|
||||
staleTime: 0,
|
||||
cacheTime: 0,
|
||||
gcTime: 0,
|
||||
...options,
|
||||
enabled: Boolean(identityId) && (options?.enabled ?? true)
|
||||
});
|
||||
@@ -214,12 +190,7 @@ export const useGetIdentityKubernetesAuth = (
|
||||
|
||||
export const useGetIdentityTokenAuth = (
|
||||
identityId: string,
|
||||
options?: UseQueryOptions<
|
||||
IdentityTokenAuth,
|
||||
unknown,
|
||||
IdentityTokenAuth,
|
||||
ReturnType<typeof identitiesKeys.getIdentityTokenAuth>
|
||||
>
|
||||
options?: TReactQueryOptions["options"]
|
||||
) => {
|
||||
return useQuery({
|
||||
queryKey: identitiesKeys.getIdentityTokenAuth(identityId),
|
||||
@@ -232,7 +203,7 @@ export const useGetIdentityTokenAuth = (
|
||||
return identityTokenAuth;
|
||||
},
|
||||
staleTime: 0,
|
||||
cacheTime: 0,
|
||||
gcTime: 0,
|
||||
...options,
|
||||
enabled: Boolean(identityId) && (options?.enabled ?? true)
|
||||
});
|
||||
@@ -255,12 +226,7 @@ export const useGetIdentityTokensTokenAuth = (identityId: string) => {
|
||||
|
||||
export const useGetIdentityOidcAuth = (
|
||||
identityId: string,
|
||||
options?: UseQueryOptions<
|
||||
IdentityOidcAuth,
|
||||
unknown,
|
||||
IdentityOidcAuth,
|
||||
ReturnType<typeof identitiesKeys.getIdentityOidcAuth>
|
||||
>
|
||||
options?: TReactQueryOptions["options"]
|
||||
) => {
|
||||
return useQuery({
|
||||
queryKey: identitiesKeys.getIdentityOidcAuth(identityId),
|
||||
@@ -273,7 +239,7 @@ export const useGetIdentityOidcAuth = (
|
||||
return identityOidcAuth;
|
||||
},
|
||||
staleTime: 0,
|
||||
cacheTime: 0,
|
||||
gcTime: 0,
|
||||
...options,
|
||||
enabled: Boolean(identityId) && (options?.enabled ?? true)
|
||||
});
|
||||
@@ -281,12 +247,7 @@ export const useGetIdentityOidcAuth = (
|
||||
|
||||
export const useGetIdentityJwtAuth = (
|
||||
identityId: string,
|
||||
options?: UseQueryOptions<
|
||||
IdentityJwtAuth,
|
||||
unknown,
|
||||
IdentityJwtAuth,
|
||||
ReturnType<typeof identitiesKeys.getIdentityJwtAuth>
|
||||
>
|
||||
options?: TReactQueryOptions["options"]
|
||||
) => {
|
||||
return useQuery({
|
||||
queryKey: identitiesKeys.getIdentityJwtAuth(identityId),
|
||||
@@ -300,7 +261,7 @@ export const useGetIdentityJwtAuth = (
|
||||
return identityJwtAuth;
|
||||
},
|
||||
staleTime: 0,
|
||||
cacheTime: 0,
|
||||
gcTime: 0,
|
||||
...options,
|
||||
enabled: Boolean(identityId) && (options?.enabled ?? true)
|
||||
});
|
||||
|
||||
@@ -19,7 +19,9 @@ export const useCreateIdentityProjectAdditionalPrivilege = () => {
|
||||
return data.privilege;
|
||||
},
|
||||
onSuccess: (_, { projectId, identityId }) => {
|
||||
queryClient.invalidateQueries(identitiyProjectPrivilegeKeys.list({ projectId, identityId }));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: identitiyProjectPrivilegeKeys.list({ projectId, identityId })
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -43,7 +45,9 @@ export const useUpdateIdentityProjectAdditionalPrivilege = () => {
|
||||
return res.privilege;
|
||||
},
|
||||
onSuccess: (_, { projectId, identityId }) => {
|
||||
queryClient.invalidateQueries(identitiyProjectPrivilegeKeys.list({ projectId, identityId }));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: identitiyProjectPrivilegeKeys.list({ projectId, identityId })
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -66,7 +70,9 @@ export const useDeleteIdentityProjectAdditionalPrivilege = () => {
|
||||
return data.privilege;
|
||||
},
|
||||
onSuccess: (_, { projectId, identityId }) => {
|
||||
queryClient.invalidateQueries(identitiyProjectPrivilegeKeys.list({ projectId, identityId }));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: identitiyProjectPrivilegeKeys.list({ projectId, identityId })
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -33,7 +33,7 @@ export const useAddIncidentContact = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { orgId }) => {
|
||||
queryClient.invalidateQueries(incidentContactKeys.getAllContact(orgId));
|
||||
queryClient.invalidateQueries({ queryKey: incidentContactKeys.getAllContact(orgId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -49,7 +49,7 @@ export const useDeleteIncidentContact = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { orgId }) => {
|
||||
queryClient.invalidateQueries(incidentContactKeys.getAllContact(orgId));
|
||||
queryClient.invalidateQueries({ queryKey: incidentContactKeys.getAllContact(orgId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -914,7 +914,9 @@ export const useAuthorizeIntegration = () => {
|
||||
return integrationAuth;
|
||||
},
|
||||
onSuccess: (res) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspaceAuthorization(res.workspace));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: { queryKey: workspaceKeys.getWorkspaceAuthorization(res.workspace) }
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -958,7 +960,9 @@ export const useSaveIntegrationAccessToken = () => {
|
||||
return integrationAuth;
|
||||
},
|
||||
onSuccess: (res) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspaceAuthorization(res.workspace));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: workspaceKeys.getWorkspaceAuthorization(res.workspace)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -975,8 +979,12 @@ export const useDeleteIntegrationAuths = () => {
|
||||
})}`
|
||||
),
|
||||
onSuccess: (_, { workspaceId }) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspaceAuthorization(workspaceId));
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspaceIntegrations(workspaceId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: workspaceKeys.getWorkspaceAuthorization(workspaceId)
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: workspaceKeys.getWorkspaceIntegrations(workspaceId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -988,8 +996,12 @@ export const useDeleteIntegrationAuth = () => {
|
||||
return useMutation<object, object, { id: string; workspaceId: string }>({
|
||||
mutationFn: ({ id }) => apiRequest.delete(`/api/v1/integration-auth/${id}`),
|
||||
onSuccess: (_, { workspaceId }) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspaceAuthorization(workspaceId));
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspaceIntegrations(workspaceId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: workspaceKeys.getWorkspaceAuthorization(workspaceId)
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: workspaceKeys.getWorkspaceIntegrations(workspaceId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -114,7 +114,9 @@ export const useCreateIntegration = () => {
|
||||
return integration;
|
||||
},
|
||||
onSuccess: (res) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspaceIntegrations(res.workspace));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: workspaceKeys.getWorkspaceIntegrations(res.workspace)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -132,8 +134,12 @@ export const useDeleteIntegration = () => {
|
||||
`/api/v1/integration/${id}?shouldDeleteIntegrationSecrets=${shouldDeleteIntegrationSecrets}`
|
||||
),
|
||||
onSuccess: (_, { workspaceId }) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspaceIntegrations(workspaceId));
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspaceAuthorization(workspaceId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: workspaceKeys.getWorkspaceIntegrations(workspaceId)
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: workspaceKeys.getWorkspaceAuthorization(workspaceId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -24,7 +24,7 @@ export const useAddExternalKms = (orgId: string) => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries(kmsKeys.getExternalKmsList(orgId));
|
||||
queryClient.invalidateQueries({ queryKey: kmsKeys.getExternalKmsList(orgId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -49,8 +49,8 @@ export const useUpdateExternalKms = (orgId: string) => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { kmsId }) => {
|
||||
queryClient.invalidateQueries(kmsKeys.getExternalKmsList(orgId));
|
||||
queryClient.invalidateQueries(kmsKeys.getExternalKmsById(kmsId));
|
||||
queryClient.invalidateQueries({ queryKey: kmsKeys.getExternalKmsList(orgId) });
|
||||
queryClient.invalidateQueries({ queryKey: kmsKeys.getExternalKmsById(kmsId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -64,7 +64,7 @@ export const useRemoveExternalKms = (orgId: string) => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries(kmsKeys.getExternalKmsList(orgId));
|
||||
queryClient.invalidateQueries({ queryKey: kmsKeys.getExternalKmsList(orgId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -82,7 +82,7 @@ export const useUpdateProjectKms = (projectId: string) => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries(kmsKeys.getActiveProjectKms(projectId));
|
||||
queryClient.invalidateQueries({ queryKey: kmsKeys.getActiveProjectKms(projectId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -98,7 +98,7 @@ export const useLoadProjectKmsBackup = (projectId: string) => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries(kmsKeys.getActiveProjectKms(projectId));
|
||||
queryClient.invalidateQueries({ queryKey: kmsKeys.getActiveProjectKms(projectId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -139,7 +139,7 @@ export const useExternalKmsFetchGcpKeys = (orgId: string) => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries(kmsKeys.getExternalKmsList(orgId));
|
||||
queryClient.invalidateQueries({ queryKey: kmsKeys.getExternalKmsList(orgId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -49,7 +49,7 @@ export const useCreateLDAPConfig = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess(_, dto) {
|
||||
queryClient.invalidateQueries(ldapConfigKeys.getLDAPConfig(dto.organizationId));
|
||||
queryClient.invalidateQueries({ queryKey: ldapConfigKeys.getLDAPConfig(dto.organizationId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -99,7 +99,7 @@ export const useUpdateLDAPConfig = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess(_, dto) {
|
||||
queryClient.invalidateQueries(ldapConfigKeys.getLDAPConfig(dto.organizationId));
|
||||
queryClient.invalidateQueries({ queryKey: ldapConfigKeys.getLDAPConfig(dto.organizationId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -123,7 +123,7 @@ export const useCreateLDAPGroupMapping = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess(_, { ldapConfigId }) {
|
||||
queryClient.invalidateQueries(ldapConfigKeys.getLDAPGroupMaps(ldapConfigId));
|
||||
queryClient.invalidateQueries({ queryKey: ldapConfigKeys.getLDAPGroupMaps(ldapConfigId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -144,7 +144,7 @@ export const useDeleteLDAPGroupMapping = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess(_, { ldapConfigId }) {
|
||||
queryClient.invalidateQueries(ldapConfigKeys.getLDAPGroupMaps(ldapConfigId));
|
||||
queryClient.invalidateQueries({ queryKey: ldapConfigKeys.getLDAPGroupMaps(ldapConfigId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -34,7 +34,9 @@ export const useImportEnvKey = () => {
|
||||
}
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getAllUserWorkspace(ProjectType.SecretManager));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: workspaceKeys.getAllUserWorkspace(ProjectType.SecretManager)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -53,8 +53,8 @@ export const useUpdateOIDCConfig = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess(_, dto) {
|
||||
queryClient.invalidateQueries(oidcConfigKeys.getOIDCConfig(dto.orgSlug));
|
||||
queryClient.invalidateQueries(organizationKeys.getUserOrganizations);
|
||||
queryClient.invalidateQueries({ queryKey: oidcConfigKeys.getOIDCConfig(dto.orgSlug) });
|
||||
queryClient.invalidateQueries({ queryKey: organizationKeys.getUserOrganizations });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -107,7 +107,7 @@ export const useCreateOIDCConfig = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess(_, dto) {
|
||||
queryClient.invalidateQueries(oidcConfigKeys.getOIDCConfig(dto.orgSlug));
|
||||
queryClient.invalidateQueries({ queryKey: oidcConfigKeys.getOIDCConfig(dto.orgSlug) });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -92,7 +92,7 @@ export const useCreateOrg = (options: { invalidate: boolean } = { invalidate: tr
|
||||
},
|
||||
onSuccess: () => {
|
||||
if (options?.invalidate) {
|
||||
queryClient.invalidateQueries(organizationKeys.getUserOrganizations);
|
||||
queryClient.invalidateQueries({ queryKey: organizationKeys.getUserOrganizations });
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -122,7 +122,7 @@ export const useUpdateOrg = () => {
|
||||
});
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries(organizationKeys.getUserOrganizations);
|
||||
queryClient.invalidateQueries({ queryKey: organizationKeys.getUserOrganizations });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -226,7 +226,9 @@ export const useUpdateOrgBillingDetails = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess(_, dto) {
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgBillingDetails(dto.organizationId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgBillingDetails(dto.organizationId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -271,7 +273,9 @@ export const useAddOrgPmtMethod = () => {
|
||||
return url;
|
||||
},
|
||||
onSuccess(_, dto) {
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgPmtMethods(dto.organizationId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgPmtMethods(dto.organizationId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -294,7 +298,9 @@ export const useDeleteOrgPmtMethod = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess(_, dto) {
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgPmtMethods(dto.organizationId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgPmtMethods(dto.organizationId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -337,7 +343,9 @@ export const useAddOrgTaxId = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess(_, dto) {
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgTaxIds(dto.organizationId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgTaxIds(dto.organizationId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -354,7 +362,9 @@ export const useDeleteOrgTaxId = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess(_, dto) {
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgTaxIds(dto.organizationId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgTaxIds(dto.organizationId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -461,20 +471,34 @@ export const useDeleteOrgById = () => {
|
||||
return organization;
|
||||
},
|
||||
onSuccess(_, dto) {
|
||||
queryClient.invalidateQueries(organizationKeys.getUserOrganizations);
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgPlanBillingInfo(dto.organizationId));
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgPlanTable(dto.organizationId));
|
||||
queryClient.invalidateQueries(
|
||||
organizationKeys.getOrgPlansTable(dto.organizationId, "monthly")
|
||||
); // You might need to invalidate for 'yearly' as well.
|
||||
queryClient.invalidateQueries(
|
||||
organizationKeys.getOrgPlansTable(dto.organizationId, "yearly")
|
||||
);
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgBillingDetails(dto.organizationId));
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgPmtMethods(dto.organizationId));
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgTaxIds(dto.organizationId));
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgInvoices(dto.organizationId));
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgLicenses(dto.organizationId));
|
||||
queryClient.invalidateQueries({ queryKey: organizationKeys.getUserOrganizations });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgPlanBillingInfo(dto.organizationId)
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgPlanTable(dto.organizationId)
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgPlansTable(dto.organizationId, "monthly")
|
||||
}); // You might need to invalidate for 'yearly' as well.
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgPlansTable(dto.organizationId, "yearly")
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgBillingDetails(dto.organizationId)
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgPmtMethods(dto.organizationId)
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgTaxIds(dto.organizationId)
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgInvoices(dto.organizationId)
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: organizationKeys.getOrgLicenses(dto.organizationId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -14,7 +14,7 @@ export const useCreatePkiAlert = () => {
|
||||
return alert;
|
||||
},
|
||||
onSuccess: (_, { projectId }) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspacePkiAlerts(projectId));
|
||||
queryClient.invalidateQueries({ queryKey: workspaceKeys.getWorkspacePkiAlerts(projectId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -30,8 +30,8 @@ export const useUpdatePkiAlert = () => {
|
||||
return alert;
|
||||
},
|
||||
onSuccess: (_, { projectId, alertId }) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspacePkiAlerts(projectId));
|
||||
queryClient.invalidateQueries(pkiAlertKeys.getPkiAlertById(alertId));
|
||||
queryClient.invalidateQueries({ queryKey: workspaceKeys.getWorkspacePkiAlerts(projectId) });
|
||||
queryClient.invalidateQueries({ queryKey: pkiAlertKeys.getPkiAlertById(alertId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -44,8 +44,8 @@ export const useDeletePkiAlert = () => {
|
||||
return alert;
|
||||
},
|
||||
onSuccess: (_, { projectId, alertId }) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspacePkiAlerts(projectId));
|
||||
queryClient.invalidateQueries(pkiAlertKeys.getPkiAlertById(alertId));
|
||||
queryClient.invalidateQueries({ queryKey: workspaceKeys.getWorkspacePkiAlerts(projectId) });
|
||||
queryClient.invalidateQueries({ queryKey: pkiAlertKeys.getPkiAlertById(alertId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -25,7 +25,9 @@ export const useCreatePkiCollection = () => {
|
||||
return pkiCollection;
|
||||
},
|
||||
onSuccess: (_, { projectId }) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspacePkiCollections(projectId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: workspaceKeys.getWorkspacePkiCollections(projectId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -41,8 +43,12 @@ export const useUpdatePkiCollection = () => {
|
||||
return pkiCollection;
|
||||
},
|
||||
onSuccess: (_, { projectId, collectionId }) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspacePkiCollections(projectId));
|
||||
queryClient.invalidateQueries(pkiCollectionKeys.getPkiCollectionById(collectionId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: workspaceKeys.getWorkspacePkiCollections(projectId)
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: pkiCollectionKeys.getPkiCollectionById(collectionId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -57,8 +63,12 @@ export const useDeletePkiCollection = () => {
|
||||
return pkiCollection;
|
||||
},
|
||||
onSuccess: (_, { projectId, collectionId }) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspacePkiCollections(projectId));
|
||||
queryClient.invalidateQueries(pkiCollectionKeys.getPkiCollectionById(collectionId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: workspaceKeys.getWorkspacePkiCollections(projectId)
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: pkiCollectionKeys.getPkiCollectionById(collectionId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -77,7 +87,9 @@ export const useAddItemToPkiCollection = () => {
|
||||
return pkiCollectionItem;
|
||||
},
|
||||
onSuccess: (_, { collectionId }) => {
|
||||
queryClient.invalidateQueries(pkiCollectionKeys.getPkiCollectionItems(collectionId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: pkiCollectionKeys.getPkiCollectionItems(collectionId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -92,7 +104,9 @@ export const useRemoveItemFromPkiCollection = () => {
|
||||
return pkiCollectionItem;
|
||||
},
|
||||
onSuccess: (_, { collectionId }) => {
|
||||
queryClient.invalidateQueries(pkiCollectionKeys.getPkiCollectionItems(collectionId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: pkiCollectionKeys.getPkiCollectionItems(collectionId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -20,7 +20,7 @@ export const useCreateProjectTemplate = () => {
|
||||
|
||||
return data.projectTemplate;
|
||||
},
|
||||
onSuccess: () => queryClient.invalidateQueries(projectTemplateKeys.list())
|
||||
onSuccess: () => queryClient.invalidateQueries({ queryKey: projectTemplateKeys.list() })
|
||||
});
|
||||
};
|
||||
|
||||
@@ -36,8 +36,8 @@ export const useUpdateProjectTemplate = () => {
|
||||
return data.projectTemplate;
|
||||
},
|
||||
onSuccess: (_, { templateId }) => {
|
||||
queryClient.invalidateQueries(projectTemplateKeys.list());
|
||||
queryClient.invalidateQueries(projectTemplateKeys.byId(templateId));
|
||||
queryClient.invalidateQueries({ queryKey: projectTemplateKeys.list() });
|
||||
queryClient.invalidateQueries({ queryKey: projectTemplateKeys.byId(templateId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -51,8 +51,8 @@ export const useDeleteProjectTemplate = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { templateId }) => {
|
||||
queryClient.invalidateQueries(projectTemplateKeys.list());
|
||||
queryClient.invalidateQueries(projectTemplateKeys.byId(templateId));
|
||||
queryClient.invalidateQueries({ queryKey: projectTemplateKeys.list() });
|
||||
queryClient.invalidateQueries({ queryKey: projectTemplateKeys.byId(templateId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -19,7 +19,9 @@ export const useCreateProjectUserAdditionalPrivilege = () => {
|
||||
return data.privilege;
|
||||
},
|
||||
onSuccess: (_, { projectMembershipId }) => {
|
||||
queryClient.invalidateQueries(projectUserPrivilegeKeys.list(projectMembershipId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: projectUserPrivilegeKeys.list(projectMembershipId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -36,7 +38,9 @@ export const useUpdateProjectUserAdditionalPrivilege = () => {
|
||||
return data.privilege;
|
||||
},
|
||||
onSuccess: (_, { projectMembershipId }) => {
|
||||
queryClient.invalidateQueries(projectUserPrivilegeKeys.list(projectMembershipId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: projectUserPrivilegeKeys.list(projectMembershipId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -52,7 +56,9 @@ export const useDeleteProjectUserAdditionalPrivilege = () => {
|
||||
return data.privilege;
|
||||
},
|
||||
onSuccess: (_, { projectMembershipId }) => {
|
||||
queryClient.invalidateQueries(projectUserPrivilegeKeys.list(projectMembershipId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: projectUserPrivilegeKeys.list(projectMembershipId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -15,7 +15,7 @@ export const useUpdateRateLimit = () => {
|
||||
},
|
||||
onSuccess: (data) => {
|
||||
queryClient.setQueryData(rateLimitQueryKeys.rateLimit(), data);
|
||||
queryClient.invalidateQueries(rateLimitQueryKeys.rateLimit());
|
||||
queryClient.invalidateQueries({ queryKey: rateLimitQueryKeys.rateLimit() });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -26,7 +26,7 @@ export const useCreateProjectRole = () => {
|
||||
return role;
|
||||
},
|
||||
onSuccess: (_, { projectId }) => {
|
||||
queryClient.invalidateQueries(roleQueryKeys.getProjectRoles(projectId));
|
||||
queryClient.invalidateQueries({ queryKey: roleQueryKeys.getProjectRoles(projectId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -42,9 +42,11 @@ export const useUpdateProjectRole = () => {
|
||||
return role;
|
||||
},
|
||||
onSuccess: (_, { projectId, slug }) => {
|
||||
queryClient.invalidateQueries(roleQueryKeys.getProjectRoles(projectId));
|
||||
queryClient.invalidateQueries({ queryKey: roleQueryKeys.getProjectRoles(projectId) });
|
||||
if (slug) {
|
||||
queryClient.invalidateQueries(roleQueryKeys.getProjectRoleBySlug(projectId, slug));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: roleQueryKeys.getProjectRoleBySlug(projectId, slug)
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -60,7 +62,7 @@ export const useDeleteProjectRole = () => {
|
||||
return role;
|
||||
},
|
||||
onSuccess: (_, { projectId }) => {
|
||||
queryClient.invalidateQueries(roleQueryKeys.getProjectRoles(projectId));
|
||||
queryClient.invalidateQueries({ queryKey: roleQueryKeys.getProjectRoles(projectId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -80,7 +82,7 @@ export const useCreateOrgRole = () => {
|
||||
return role;
|
||||
},
|
||||
onSuccess: (_, { orgId }) => {
|
||||
queryClient.invalidateQueries(roleQueryKeys.getOrgRoles(orgId));
|
||||
queryClient.invalidateQueries({ queryKey: roleQueryKeys.getOrgRoles(orgId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -100,8 +102,8 @@ export const useUpdateOrgRole = () => {
|
||||
return role;
|
||||
},
|
||||
onSuccess: (_, { id, orgId }) => {
|
||||
queryClient.invalidateQueries(roleQueryKeys.getOrgRoles(orgId));
|
||||
queryClient.invalidateQueries(roleQueryKeys.getOrgRole(orgId, id));
|
||||
queryClient.invalidateQueries({ queryKey: roleQueryKeys.getOrgRoles(orgId) });
|
||||
queryClient.invalidateQueries({ queryKey: roleQueryKeys.getOrgRole(orgId, id) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -120,8 +122,8 @@ export const useDeleteOrgRole = () => {
|
||||
return role;
|
||||
},
|
||||
onSuccess: (_, { id, orgId }) => {
|
||||
queryClient.invalidateQueries(roleQueryKeys.getOrgRoles(orgId));
|
||||
queryClient.invalidateQueries(roleQueryKeys.getOrgRole(orgId, id));
|
||||
queryClient.invalidateQueries({ queryKey: roleQueryKeys.getOrgRoles(orgId) });
|
||||
queryClient.invalidateQueries({ queryKey: roleQueryKeys.getOrgRole(orgId, id) });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -18,7 +18,7 @@ export const useCreateScimToken = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { organizationId }) => {
|
||||
queryClient.invalidateQueries(scimKeys.getScimTokens(organizationId));
|
||||
queryClient.invalidateQueries({ queryKey: scimKeys.getScimTokens(organizationId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -31,7 +31,7 @@ export const useDeleteScimToken = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { organizationId }) => {
|
||||
queryClient.invalidateQueries(scimKeys.getScimTokens(organizationId));
|
||||
queryClient.invalidateQueries({ queryKey: scimKeys.getScimTokens(organizationId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -30,7 +30,9 @@ export const useCreateSecretApprovalPolicy = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { workspaceId }) => {
|
||||
queryClient.invalidateQueries(secretApprovalKeys.getApprovalPolicies(workspaceId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretApprovalKeys.getApprovalPolicies(workspaceId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -50,7 +52,9 @@ export const useUpdateSecretApprovalPolicy = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { workspaceId }) => {
|
||||
queryClient.invalidateQueries(secretApprovalKeys.getApprovalPolicies(workspaceId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretApprovalKeys.getApprovalPolicies(workspaceId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -64,7 +68,9 @@ export const useDeleteSecretApprovalPolicy = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { workspaceId }) => {
|
||||
queryClient.invalidateQueries(secretApprovalKeys.getApprovalPolicies(workspaceId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretApprovalKeys.getApprovalPolicies(workspaceId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useQuery, UseQueryOptions } from "@tanstack/react-query";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import { apiRequest } from "@app/config/request";
|
||||
import { TReactQueryOptions } from "@app/types/reactQuery";
|
||||
|
||||
import {
|
||||
TGetSecretApprovalPoliciesDTO,
|
||||
@@ -28,14 +29,7 @@ const fetchApprovalPolicies = async (workspaceId: string) => {
|
||||
export const useGetSecretApprovalPolicies = ({
|
||||
workspaceId,
|
||||
options = {}
|
||||
}: TGetSecretApprovalPoliciesDTO & {
|
||||
options?: UseQueryOptions<
|
||||
TSecretApprovalPolicy[],
|
||||
unknown,
|
||||
TSecretApprovalPolicy[],
|
||||
ReturnType<typeof secretApprovalKeys.getApprovalPolicies>
|
||||
>;
|
||||
}) =>
|
||||
}: TGetSecretApprovalPoliciesDTO & TReactQueryOptions) =>
|
||||
useQuery({
|
||||
queryKey: secretApprovalKeys.getApprovalPolicies(workspaceId),
|
||||
queryFn: () => fetchApprovalPolicies(workspaceId),
|
||||
@@ -60,14 +54,7 @@ export const useGetSecretApprovalPolicyOfABoard = ({
|
||||
secretPath = "/",
|
||||
environment,
|
||||
options = {}
|
||||
}: TGetSecretApprovalPolicyOfBoardDTO & {
|
||||
options?: UseQueryOptions<
|
||||
TSecretApprovalPolicy,
|
||||
unknown,
|
||||
TSecretApprovalPolicy,
|
||||
ReturnType<typeof secretApprovalKeys.getApprovalPolicyOfABoard>
|
||||
>;
|
||||
}) =>
|
||||
}: TGetSecretApprovalPolicyOfBoardDTO & TReactQueryOptions) =>
|
||||
useQuery({
|
||||
queryKey: secretApprovalKeys.getApprovalPolicyOfABoard(workspaceId, environment, secretPath),
|
||||
queryFn: () => fetchApprovalPolicyOfABoard(workspaceId, environment, secretPath),
|
||||
|
||||
@@ -20,7 +20,7 @@ export const useUpdateSecretApprovalReviewStatus = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { id }) => {
|
||||
queryClient.invalidateQueries(secretApprovalRequestKeys.detail({ id }));
|
||||
queryClient.invalidateQueries({ queryKey: secretApprovalRequestKeys.detail({ id }) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -36,8 +36,8 @@ export const useUpdateSecretApprovalRequestStatus = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { id, workspaceId }) => {
|
||||
queryClient.invalidateQueries(secretApprovalRequestKeys.detail({ id }));
|
||||
queryClient.invalidateQueries(secretApprovalRequestKeys.count({ workspaceId }));
|
||||
queryClient.invalidateQueries({ queryKey: secretApprovalRequestKeys.detail({ id }) });
|
||||
queryClient.invalidateQueries({ queryKey: secretApprovalRequestKeys.count({ workspaceId }) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -53,9 +53,9 @@ export const usePerformSecretApprovalRequestMerge = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { id, workspaceId }) => {
|
||||
queryClient.invalidateQueries(secretApprovalRequestKeys.detail({ id }));
|
||||
queryClient.invalidateQueries(secretApprovalRequestKeys.list({ workspaceId }));
|
||||
queryClient.invalidateQueries(secretApprovalRequestKeys.count({ workspaceId }));
|
||||
queryClient.invalidateQueries({ queryKey: secretApprovalRequestKeys.detail({ id }) });
|
||||
queryClient.invalidateQueries({ queryKey: secretApprovalRequestKeys.list({ workspaceId }) });
|
||||
queryClient.invalidateQueries({ queryKey: secretApprovalRequestKeys.count({ workspaceId }) });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
/* eslint-disable no-param-reassign */
|
||||
import {
|
||||
useInfiniteQuery,
|
||||
UseInfiniteQueryOptions,
|
||||
useQuery,
|
||||
UseQueryOptions
|
||||
} from "@tanstack/react-query";
|
||||
import { useInfiniteQuery, useQuery, UseQueryOptions } from "@tanstack/react-query";
|
||||
|
||||
import {
|
||||
decryptAssymmetric,
|
||||
decryptSymmetric
|
||||
} from "@app/components/utilities/cryptography/crypto";
|
||||
import { apiRequest } from "@app/config/request";
|
||||
import { TReactQueryOptions } from "@app/types/reactQuery";
|
||||
|
||||
import { UserWsKeyPair } from "../keys/types";
|
||||
import { EncryptedSecret, SecretType, SecretV3RawSanitized } from "../secrets/types";
|
||||
@@ -147,18 +143,9 @@ export const useGetSecretApprovalRequests = ({
|
||||
status,
|
||||
limit = 20,
|
||||
committer
|
||||
}: TGetSecretApprovalRequestList & {
|
||||
options?: Omit<
|
||||
UseInfiniteQueryOptions<
|
||||
TSecretApprovalRequest[],
|
||||
unknown,
|
||||
TSecretApprovalRequest[],
|
||||
ReturnType<typeof secretApprovalRequestKeys.list>
|
||||
>,
|
||||
"queryKey" | "queryFn"
|
||||
>;
|
||||
}) =>
|
||||
}: TGetSecretApprovalRequestList & TReactQueryOptions) =>
|
||||
useInfiniteQuery({
|
||||
initialPageParam: 0,
|
||||
queryKey: secretApprovalRequestKeys.list({
|
||||
workspaceId,
|
||||
environment,
|
||||
|
||||
@@ -125,21 +125,21 @@ export const useCreateFolder = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { projectId, environment, path }) => {
|
||||
queryClient.invalidateQueries(
|
||||
dashboardKeys.getDashboardSecrets({
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: dashboardKeys.getDashboardSecrets({
|
||||
projectId,
|
||||
secretPath: path ?? "/"
|
||||
})
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
folderQueryKeys.getSecretFolders({ projectId, environment, path })
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
secretSnapshotKeys.list({ workspaceId: projectId, environment, directory: path })
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
secretSnapshotKeys.count({ workspaceId: projectId, environment, directory: path })
|
||||
);
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: folderQueryKeys.getSecretFolders({ projectId, environment, path })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretSnapshotKeys.list({ workspaceId: projectId, environment, directory: path })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretSnapshotKeys.count({ workspaceId: projectId, environment, directory: path })
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -158,21 +158,21 @@ export const useUpdateFolder = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { projectId, environment, path }) => {
|
||||
queryClient.invalidateQueries(
|
||||
dashboardKeys.getDashboardSecrets({
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: dashboardKeys.getDashboardSecrets({
|
||||
projectId,
|
||||
secretPath: path ?? "/"
|
||||
})
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
folderQueryKeys.getSecretFolders({ projectId, environment, path })
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
secretSnapshotKeys.list({ workspaceId: projectId, environment, directory: path })
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
secretSnapshotKeys.count({ workspaceId: projectId, environment, directory: path })
|
||||
);
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: folderQueryKeys.getSecretFolders({ projectId, environment, path })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretSnapshotKeys.list({ workspaceId: projectId, environment, directory: path })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretSnapshotKeys.count({ workspaceId: projectId, environment, directory: path })
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -192,21 +192,21 @@ export const useDeleteFolder = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { path = "/", projectId, environment }) => {
|
||||
queryClient.invalidateQueries(
|
||||
dashboardKeys.getDashboardSecrets({
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: dashboardKeys.getDashboardSecrets({
|
||||
projectId,
|
||||
secretPath: path
|
||||
})
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
folderQueryKeys.getSecretFolders({ projectId, environment, path })
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
secretSnapshotKeys.list({ workspaceId: projectId, environment, directory: path })
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
secretSnapshotKeys.count({ workspaceId: projectId, environment, directory: path })
|
||||
);
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: folderQueryKeys.getSecretFolders({ projectId, environment, path })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretSnapshotKeys.list({ workspaceId: projectId, environment, directory: path })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretSnapshotKeys.count({ workspaceId: projectId, environment, directory: path })
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -225,33 +225,33 @@ export const useUpdateFolderBatch = () => {
|
||||
},
|
||||
onSuccess: (_, { projectId, folders }) => {
|
||||
folders.forEach((folder) => {
|
||||
queryClient.invalidateQueries(
|
||||
dashboardKeys.getDashboardSecrets({
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: dashboardKeys.getDashboardSecrets({
|
||||
projectId,
|
||||
secretPath: folder.path ?? "/"
|
||||
})
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
folderQueryKeys.getSecretFolders({
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: folderQueryKeys.getSecretFolders({
|
||||
projectId,
|
||||
environment: folder.environment,
|
||||
path: folder.path
|
||||
})
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
secretSnapshotKeys.list({
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretSnapshotKeys.list({
|
||||
workspaceId: projectId,
|
||||
environment: folder.environment,
|
||||
directory: folder.path
|
||||
})
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
secretSnapshotKeys.count({
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretSnapshotKeys.count({
|
||||
workspaceId: projectId,
|
||||
environment: folder.environment,
|
||||
directory: folder.path
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -26,15 +26,15 @@ export const useCreateSecretImport = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { environment, projectId, path }) => {
|
||||
queryClient.invalidateQueries(
|
||||
secretImportKeys.getProjectSecretImports({ projectId, environment, path })
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
secretImportKeys.getSecretImportSecrets({ projectId, environment, path })
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
dashboardKeys.getDashboardSecrets({ projectId, secretPath: path ?? "/" })
|
||||
);
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretImportKeys.getProjectSecretImports({ projectId, environment, path })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretImportKeys.getSecretImportSecrets({ projectId, environment, path })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: dashboardKeys.getDashboardSecrets({ projectId, secretPath: path ?? "/" })
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -53,15 +53,15 @@ export const useUpdateSecretImport = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { environment, projectId, path }) => {
|
||||
queryClient.invalidateQueries(
|
||||
secretImportKeys.getProjectSecretImports({ projectId, path, environment })
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
secretImportKeys.getSecretImportSecrets({ environment, path, projectId })
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
dashboardKeys.getDashboardSecrets({ projectId, secretPath: path ?? "/" })
|
||||
);
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretImportKeys.getProjectSecretImports({ projectId, environment, path })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretImportKeys.getSecretImportSecrets({ projectId, environment, path })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: dashboardKeys.getDashboardSecrets({ projectId, secretPath: path ?? "/" })
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -94,15 +94,15 @@ export const useDeleteSecretImport = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { projectId, environment, path }) => {
|
||||
queryClient.invalidateQueries(
|
||||
secretImportKeys.getProjectSecretImports({ projectId, environment, path })
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
secretImportKeys.getSecretImportSecrets({ projectId, environment, path })
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
dashboardKeys.getDashboardSecrets({ projectId, secretPath: path ?? "/" })
|
||||
);
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretImportKeys.getProjectSecretImports({ projectId, environment, path })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretImportKeys.getSecretImportSecrets({ projectId, environment, path })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: dashboardKeys.getDashboardSecrets({ projectId, secretPath: path ?? "/" })
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -18,7 +18,7 @@ export const useCreateSecretRotation = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { workspaceId }) => {
|
||||
queryClient.invalidateQueries(secretRotationKeys.list({ workspaceId }));
|
||||
queryClient.invalidateQueries({ queryKey: secretRotationKeys.list({ workspaceId }) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -32,7 +32,7 @@ export const useDeleteSecretRotation = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { workspaceId }) => {
|
||||
queryClient.invalidateQueries(secretRotationKeys.list({ workspaceId }));
|
||||
queryClient.invalidateQueries({ queryKey: secretRotationKeys.list({ workspaceId }) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -46,7 +46,7 @@ export const useRestartSecretRotation = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { workspaceId }) => {
|
||||
queryClient.invalidateQueries(secretRotationKeys.list({ workspaceId }));
|
||||
queryClient.invalidateQueries({ queryKey: secretRotationKeys.list({ workspaceId }) });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -20,7 +20,8 @@ export const useCreateSharedSecret = () => {
|
||||
);
|
||||
return data;
|
||||
},
|
||||
onSuccess: () => queryClient.invalidateQueries(secretSharingKeys.allSharedSecrets())
|
||||
onSuccess: () =>
|
||||
queryClient.invalidateQueries({ queryKey: secretSharingKeys.allSharedSecrets() })
|
||||
});
|
||||
};
|
||||
|
||||
@@ -34,7 +35,8 @@ export const useCreatePublicSharedSecret = () => {
|
||||
);
|
||||
return data;
|
||||
},
|
||||
onSuccess: () => queryClient.invalidateQueries(secretSharingKeys.allSharedSecrets())
|
||||
onSuccess: () =>
|
||||
queryClient.invalidateQueries({ queryKey: secretSharingKeys.allSharedSecrets() })
|
||||
});
|
||||
};
|
||||
|
||||
@@ -47,6 +49,7 @@ export const useDeleteSharedSecret = () => {
|
||||
);
|
||||
return data;
|
||||
},
|
||||
onSuccess: () => queryClient.invalidateQueries(secretSharingKeys.allSharedSecrets())
|
||||
onSuccess: () =>
|
||||
queryClient.invalidateQueries({ queryKey: secretSharingKeys.allSharedSecrets() })
|
||||
});
|
||||
};
|
||||
|
||||
@@ -51,7 +51,6 @@ export const useGetActiveSharedSecretById = ({
|
||||
}) => {
|
||||
return useQuery({
|
||||
queryKey: secretSharingKeys.getSecretById({ id: sharedSecretId, hashedHex, password }),
|
||||
|
||||
queryFn: async () => {
|
||||
const { data } = await apiRequest.post<TViewSharedSecretResponse>(
|
||||
`/api/v1/secret-sharing/public/${sharedSecretId}`,
|
||||
@@ -62,8 +61,7 @@ export const useGetActiveSharedSecretById = ({
|
||||
);
|
||||
|
||||
return data;
|
||||
}
|
||||
}, {
|
||||
},
|
||||
enabled: Boolean(sharedSecretId)
|
||||
});
|
||||
};
|
||||
|
||||
@@ -47,6 +47,7 @@ const fetchWorkspaceSnaphots = async ({
|
||||
|
||||
export const useGetWorkspaceSnapshotList = (dto: TGetSecretSnapshotsDTO & { isPaused?: boolean }) =>
|
||||
useInfiniteQuery({
|
||||
initialPageParam: 0,
|
||||
enabled: Boolean(dto.workspaceId && dto.environment) && !dto.isPaused,
|
||||
queryKey: secretSnapshotKeys.list({ ...dto }),
|
||||
queryFn: ({ pageParam }) => fetchWorkspaceSnaphots({ ...dto, offset: pageParam }),
|
||||
@@ -149,23 +150,17 @@ export const usePerformSecretRollback = () => {
|
||||
},
|
||||
onSuccess: (_, { workspaceId, environment, directory }) => {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [
|
||||
{ workspaceId, environment, secretPath: directory },
|
||||
"secrets"
|
||||
]
|
||||
queryKey: [{ workspaceId, environment, secretPath: directory }, "secrets"]
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [
|
||||
"secret-folders",
|
||||
{ projectId: workspaceId, environment, path: directory }
|
||||
]
|
||||
queryKey: ["secret-folders", { projectId: workspaceId, environment, path: directory }]
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretSnapshotKeys.list({ workspaceId, environment, directory })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretSnapshotKeys.count({ workspaceId, environment, directory })
|
||||
});
|
||||
queryClient.invalidateQueries(
|
||||
secretSnapshotKeys.list({ workspaceId, environment, directory })
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
secretSnapshotKeys.count({ workspaceId, environment, directory })
|
||||
);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -47,19 +47,19 @@ export const useCreateSecretV3 = ({
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { workspaceId, environment, secretPath }) => {
|
||||
queryClient.invalidateQueries(
|
||||
dashboardKeys.getDashboardSecrets({ projectId: workspaceId, secretPath })
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
secretKeys.getProjectSecret({ workspaceId, environment, secretPath })
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
secretSnapshotKeys.list({ environment, workspaceId, directory: secretPath })
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
secretSnapshotKeys.count({ environment, workspaceId, directory: secretPath })
|
||||
);
|
||||
queryClient.invalidateQueries(secretApprovalRequestKeys.count({ workspaceId }));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: dashboardKeys.getDashboardSecrets({ projectId: workspaceId, secretPath })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretKeys.getProjectSecret({ workspaceId, environment, secretPath })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretSnapshotKeys.list({ environment, workspaceId, directory: secretPath })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretSnapshotKeys.count({ environment, workspaceId, directory: secretPath })
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: secretApprovalRequestKeys.count({ workspaceId }) });
|
||||
},
|
||||
...options
|
||||
});
|
||||
@@ -102,19 +102,19 @@ export const useUpdateSecretV3 = ({
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { workspaceId, environment, secretPath }) => {
|
||||
queryClient.invalidateQueries(
|
||||
dashboardKeys.getDashboardSecrets({ projectId: workspaceId, secretPath })
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
secretKeys.getProjectSecret({ workspaceId, environment, secretPath })
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
secretSnapshotKeys.list({ environment, workspaceId, directory: secretPath })
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
secretSnapshotKeys.count({ environment, workspaceId, directory: secretPath })
|
||||
);
|
||||
queryClient.invalidateQueries(secretApprovalRequestKeys.count({ workspaceId }));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: dashboardKeys.getDashboardSecrets({ projectId: workspaceId, secretPath })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretKeys.getProjectSecret({ workspaceId, environment, secretPath })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretSnapshotKeys.list({ environment, workspaceId, directory: secretPath })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretSnapshotKeys.count({ environment, workspaceId, directory: secretPath })
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: secretApprovalRequestKeys.count({ workspaceId }) });
|
||||
},
|
||||
...options
|
||||
});
|
||||
@@ -148,19 +148,19 @@ export const useDeleteSecretV3 = ({
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { workspaceId, environment, secretPath }) => {
|
||||
queryClient.invalidateQueries(
|
||||
dashboardKeys.getDashboardSecrets({ projectId: workspaceId, secretPath })
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
secretKeys.getProjectSecret({ workspaceId, environment, secretPath })
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
secretSnapshotKeys.list({ environment, workspaceId, directory: secretPath })
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
secretSnapshotKeys.count({ environment, workspaceId, directory: secretPath })
|
||||
);
|
||||
queryClient.invalidateQueries(secretApprovalRequestKeys.count({ workspaceId }));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: dashboardKeys.getDashboardSecrets({ projectId: workspaceId, secretPath })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretKeys.getProjectSecret({ workspaceId, environment, secretPath })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretSnapshotKeys.list({ environment, workspaceId, directory: secretPath })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretSnapshotKeys.count({ environment, workspaceId, directory: secretPath })
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: secretApprovalRequestKeys.count({ workspaceId }) });
|
||||
},
|
||||
...options
|
||||
});
|
||||
@@ -184,19 +184,19 @@ export const useCreateSecretBatch = ({
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { workspaceId, environment, secretPath }) => {
|
||||
queryClient.invalidateQueries(
|
||||
dashboardKeys.getDashboardSecrets({ projectId: workspaceId, secretPath })
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
secretKeys.getProjectSecret({ workspaceId, environment, secretPath })
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
secretSnapshotKeys.list({ environment, workspaceId, directory: secretPath })
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
secretSnapshotKeys.count({ environment, workspaceId, directory: secretPath })
|
||||
);
|
||||
queryClient.invalidateQueries(secretApprovalRequestKeys.count({ workspaceId }));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: dashboardKeys.getDashboardSecrets({ projectId: workspaceId, secretPath })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretKeys.getProjectSecret({ workspaceId, environment, secretPath })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretSnapshotKeys.list({ environment, workspaceId, directory: secretPath })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretSnapshotKeys.count({ environment, workspaceId, directory: secretPath })
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: secretApprovalRequestKeys.count({ workspaceId }) });
|
||||
},
|
||||
...options
|
||||
});
|
||||
@@ -220,19 +220,19 @@ export const useUpdateSecretBatch = ({
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { workspaceId, environment, secretPath }) => {
|
||||
queryClient.invalidateQueries(
|
||||
dashboardKeys.getDashboardSecrets({ projectId: workspaceId, secretPath })
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
secretKeys.getProjectSecret({ workspaceId, environment, secretPath })
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
secretSnapshotKeys.list({ environment, workspaceId, directory: secretPath })
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
secretSnapshotKeys.count({ environment, workspaceId, directory: secretPath })
|
||||
);
|
||||
queryClient.invalidateQueries(secretApprovalRequestKeys.count({ workspaceId }));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: dashboardKeys.getDashboardSecrets({ projectId: workspaceId, secretPath })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretKeys.getProjectSecret({ workspaceId, environment, secretPath })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretSnapshotKeys.list({ environment, workspaceId, directory: secretPath })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretSnapshotKeys.count({ environment, workspaceId, directory: secretPath })
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: secretApprovalRequestKeys.count({ workspaceId }) });
|
||||
},
|
||||
...options
|
||||
});
|
||||
@@ -258,19 +258,19 @@ export const useDeleteSecretBatch = ({
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { workspaceId, environment, secretPath }) => {
|
||||
queryClient.invalidateQueries(
|
||||
dashboardKeys.getDashboardSecrets({ projectId: workspaceId, secretPath })
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
secretKeys.getProjectSecret({ workspaceId, environment, secretPath })
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
secretSnapshotKeys.list({ environment, workspaceId, directory: secretPath })
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
secretSnapshotKeys.count({ environment, workspaceId, directory: secretPath })
|
||||
);
|
||||
queryClient.invalidateQueries(secretApprovalRequestKeys.count({ workspaceId }));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: dashboardKeys.getDashboardSecrets({ projectId: workspaceId, secretPath })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretKeys.getProjectSecret({ workspaceId, environment, secretPath })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretSnapshotKeys.list({ environment, workspaceId, directory: secretPath })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretSnapshotKeys.count({ environment, workspaceId, directory: secretPath })
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: secretApprovalRequestKeys.count({ workspaceId }) });
|
||||
},
|
||||
...options
|
||||
});
|
||||
@@ -316,34 +316,36 @@ export const useMoveSecrets = ({
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { projectId, sourceEnvironment, sourceSecretPath }) => {
|
||||
queryClient.invalidateQueries(
|
||||
dashboardKeys.getDashboardSecrets({
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: dashboardKeys.getDashboardSecrets({
|
||||
projectId,
|
||||
secretPath: sourceSecretPath
|
||||
})
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
secretKeys.getProjectSecret({
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretKeys.getProjectSecret({
|
||||
workspaceId: projectId,
|
||||
environment: sourceEnvironment,
|
||||
secretPath: sourceSecretPath
|
||||
})
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
secretSnapshotKeys.list({
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretSnapshotKeys.list({
|
||||
environment: sourceEnvironment,
|
||||
workspaceId: projectId,
|
||||
directory: sourceSecretPath
|
||||
})
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
secretSnapshotKeys.count({
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretSnapshotKeys.count({
|
||||
environment: sourceEnvironment,
|
||||
workspaceId: projectId,
|
||||
directory: sourceSecretPath
|
||||
})
|
||||
);
|
||||
queryClient.invalidateQueries(secretApprovalRequestKeys.count({ workspaceId: projectId }));
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretApprovalRequestKeys.count({ workspaceId: projectId })
|
||||
});
|
||||
},
|
||||
...options
|
||||
});
|
||||
|
||||
@@ -115,26 +115,6 @@ export const useGetProjectSecrets = ({
|
||||
enabled: Boolean(workspaceId && environment) && (options?.enabled ?? true),
|
||||
queryKey: secretKeys.getProjectSecret({ workspaceId, environment, secretPath }),
|
||||
queryFn: () => fetchProjectSecrets({ workspaceId, environment, secretPath }),
|
||||
onError: (error) => {
|
||||
if (axios.isAxiosError(error)) {
|
||||
const { message, requestId } = error.response?.data as {
|
||||
message: string;
|
||||
requestId: string;
|
||||
};
|
||||
createNotification({
|
||||
title: "Error fetching secrets",
|
||||
type: "error",
|
||||
text: message,
|
||||
copyActions: [
|
||||
{
|
||||
value: requestId,
|
||||
name: "Request ID",
|
||||
label: `Request ID: ${requestId}`
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
},
|
||||
select: useCallback(
|
||||
(data: Awaited<ReturnType<typeof fetchProjectSecrets>>) => mergePersonalSecrets(data.secrets),
|
||||
[]
|
||||
|
||||
@@ -43,7 +43,9 @@ export const useCreateServiceToken = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: ({ serviceTokenData: { projectId } }) => {
|
||||
queryClient.invalidateQueries(serviceTokenKeys.getAllWorkspaceServiceToken(projectId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: serviceTokenKeys.getAllWorkspaceServiceToken(projectId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -57,7 +59,9 @@ export const useDeleteServiceToken = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: ({ serviceTokenData: { projectId } }) => {
|
||||
queryClient.invalidateQueries(serviceTokenKeys.getAllWorkspaceServiceToken(projectId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: serviceTokenKeys.getAllWorkspaceServiceToken(projectId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -55,7 +55,7 @@ export const useCreateSSOConfig = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess(_, dto) {
|
||||
queryClient.invalidateQueries(ssoConfigKeys.getSSOConfig(dto.organizationId));
|
||||
queryClient.invalidateQueries({ queryKey: ssoConfigKeys.getSSOConfig(dto.organizationId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -91,10 +91,10 @@ export const useUpdateSSOConfig = () => {
|
||||
},
|
||||
onSuccess(_, { organizationId, isActive }) {
|
||||
if (isActive === false) {
|
||||
queryClient.invalidateQueries(organizationKeys.getUserOrganizations);
|
||||
queryClient.invalidateQueries({ queryKey: organizationKeys.getUserOrganizations });
|
||||
}
|
||||
|
||||
queryClient.invalidateQueries(ssoConfigKeys.getSSOConfig(organizationId));
|
||||
queryClient.invalidateQueries({ queryKey: ssoConfigKeys.getSSOConfig(organizationId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -39,7 +39,7 @@ export const useCreateWsTag = () => {
|
||||
return data.workspaceTag;
|
||||
},
|
||||
onSuccess: (tagData) => {
|
||||
queryClient.invalidateQueries(workspaceTags.getWsTags(tagData?.projectId));
|
||||
queryClient.invalidateQueries({ queryKey: workspaceTags.getWsTags(tagData?.projectId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -55,7 +55,7 @@ export const useDeleteWsTag = () => {
|
||||
return data.workspaceTag;
|
||||
},
|
||||
onSuccess: (tagData) => {
|
||||
queryClient.invalidateQueries(workspaceTags.getWsTags(tagData?.projectId));
|
||||
queryClient.invalidateQueries({ queryKey: workspaceTags.getWsTags(tagData?.projectId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -44,7 +44,7 @@ export const useAddTrustedIp = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess(_, dto) {
|
||||
queryClient.invalidateQueries(trustedIps.getTrustedIps(dto.workspaceId));
|
||||
queryClient.invalidateQueries({ queryKey: trustedIps.getTrustedIps(dto.workspaceId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -77,7 +77,7 @@ export const useUpdateTrustedIp = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess(_, dto) {
|
||||
queryClient.invalidateQueries(trustedIps.getTrustedIps(dto.workspaceId));
|
||||
queryClient.invalidateQueries({ queryKey: trustedIps.getTrustedIps(dto.workspaceId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -99,7 +99,7 @@ export const useDeleteTrustedIp = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess(_, dto) {
|
||||
queryClient.invalidateQueries(trustedIps.getTrustedIps(dto.workspaceId));
|
||||
queryClient.invalidateQueries({ queryKey: trustedIps.getTrustedIps(dto.workspaceId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -42,7 +42,7 @@ export const useAddUserToWsE2EE = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { workspaceId }) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspaceUsers(workspaceId));
|
||||
queryClient.invalidateQueries({ queryKey: workspaceKeys.getWorkspaceUsers(workspaceId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -59,8 +59,10 @@ export const useAddUserToWsNonE2EE = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { orgId, projectId }) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspaceUsers(projectId));
|
||||
queryClient.invalidateQueries(userKeys.allOrgMembershipProjectMemberships(orgId));
|
||||
queryClient.invalidateQueries({ queryKey: workspaceKeys.getWorkspaceUsers(projectId) });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: userKeys.allOrgMembershipProjectMemberships(orgId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -110,7 +112,7 @@ export const useUpdateUserProjectFavorites = () => {
|
||||
return {};
|
||||
},
|
||||
onSuccess: (_, { orgId }) => {
|
||||
queryClient.invalidateQueries(userKeys.userProjectFavorites(orgId));
|
||||
queryClient.invalidateQueries({ queryKey: userKeys.userProjectFavorites(orgId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -136,7 +138,7 @@ export const useDeleteUserTotpConfiguration = () => {
|
||||
return {};
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries(userKeys.totpConfiguration);
|
||||
queryClient.invalidateQueries({ queryKey: userKeys.totpConfiguration });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -150,7 +152,7 @@ export const useCreateNewTotpRecoveryCodes = () => {
|
||||
return {};
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries(userKeys.totpConfiguration);
|
||||
queryClient.invalidateQueries({ queryKey: userKeys.totpConfiguration });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -31,7 +31,11 @@ export const fetchUserDetails = async () => {
|
||||
return data.user;
|
||||
};
|
||||
|
||||
export const useGetUser = () => useQuery(userKeys.getUser, fetchUserDetails);
|
||||
export const useGetUser = () =>
|
||||
useQuery({
|
||||
queryKey: userKeys.getUser,
|
||||
queryFn: fetchUserDetails
|
||||
});
|
||||
|
||||
export const useDeleteMe = () => {
|
||||
const queryClient = useQueryClient();
|
||||
@@ -87,7 +91,7 @@ export const useRenameUser = () => {
|
||||
lastName: newName?.split(" ").slice(1).join(" ")
|
||||
}),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries(userKeys.getUser);
|
||||
queryClient.invalidateQueries({ queryKey: userKeys.getUser });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -106,7 +110,7 @@ export const useUpdateUserAuthMethods = () => {
|
||||
return user;
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries(userKeys.getUser);
|
||||
queryClient.invalidateQueries({ queryKey: userKeys.getUser });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -157,13 +161,15 @@ export const useAddUsersToOrg = () => {
|
||||
return apiRequest.post("/api/v1/invite-org/signup", dto);
|
||||
},
|
||||
onSuccess: (_, { organizationId, projects }) => {
|
||||
queryClient.invalidateQueries(userKeys.getOrgUsers(organizationId));
|
||||
queryClient.invalidateQueries({ queryKey: userKeys.getOrgUsers(organizationId) });
|
||||
|
||||
projects?.forEach((project) => {
|
||||
if (project.slug) {
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspaceGroupMemberships(project.slug));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: workspaceKeys.getWorkspaceGroupMemberships(project.slug)
|
||||
});
|
||||
}
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspaceUsers(project.id));
|
||||
queryClient.invalidateQueries({ queryKey: workspaceKeys.getWorkspaceUsers(project.id) });
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -212,7 +218,7 @@ export const useDeleteOrgMembership = () => {
|
||||
return apiRequest.delete(`/api/v2/organizations/${orgId}/memberships/${membershipId}`);
|
||||
},
|
||||
onSuccess: (_, { orgId }) => {
|
||||
queryClient.invalidateQueries(userKeys.getOrgUsers(orgId));
|
||||
queryClient.invalidateQueries({ queryKey: userKeys.getOrgUsers(orgId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -227,8 +233,8 @@ export const useDeactivateOrgMembership = () => {
|
||||
);
|
||||
},
|
||||
onSuccess: (_, { orgId, membershipId }) => {
|
||||
queryClient.invalidateQueries(userKeys.getOrgUsers(orgId));
|
||||
queryClient.invalidateQueries(userKeys.getOrgMembership(orgId, membershipId));
|
||||
queryClient.invalidateQueries({ queryKey: userKeys.getOrgUsers(orgId) });
|
||||
queryClient.invalidateQueries({ queryKey: userKeys.getOrgMembership(orgId, membershipId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -248,13 +254,17 @@ export const useUpdateOrgMembership = () => {
|
||||
);
|
||||
},
|
||||
onSuccess: (_, { organizationId, membershipId }) => {
|
||||
queryClient.invalidateQueries(userKeys.getOrgUsers(organizationId));
|
||||
queryClient.invalidateQueries(userKeys.getOrgMembership(organizationId, membershipId));
|
||||
queryClient.invalidateQueries({ queryKey: userKeys.getOrgUsers(organizationId) });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: userKeys.getOrgMembership(organizationId, membershipId)
|
||||
});
|
||||
},
|
||||
// to remove old states
|
||||
onError: (_, { organizationId, membershipId }) => {
|
||||
queryClient.invalidateQueries(userKeys.getOrgUsers(organizationId));
|
||||
queryClient.invalidateQueries(userKeys.getOrgMembership(organizationId, membershipId));
|
||||
queryClient.invalidateQueries({ queryKey: userKeys.getOrgUsers(organizationId) });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: userKeys.getOrgMembership(organizationId, membershipId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -264,7 +274,7 @@ export const useRegisterUserAction = () => {
|
||||
return useMutation<object, object, string>({
|
||||
mutationFn: (action) => apiRequest.post("/api/v1/user-action", { action }),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries(userKeys.userAction);
|
||||
queryClient.invalidateQueries({ queryKey: userKeys.userAction });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -346,7 +356,7 @@ export const useCreateAPIKey = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess() {
|
||||
queryClient.invalidateQueries(userKeys.myAPIKeys);
|
||||
queryClient.invalidateQueries({ queryKey: userKeys.myAPIKeys });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -361,7 +371,7 @@ export const useDeleteAPIKey = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess() {
|
||||
queryClient.invalidateQueries(userKeys.myAPIKeys);
|
||||
queryClient.invalidateQueries({ queryKey: userKeys.myAPIKeys });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -387,7 +397,7 @@ export const useRevokeMySessions = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess() {
|
||||
queryClient.invalidateQueries(userKeys.mySessions);
|
||||
queryClient.invalidateQueries({ queryKey: userKeys.mySessions });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -412,7 +422,7 @@ export const useUpdateUserMfa = () => {
|
||||
return user;
|
||||
},
|
||||
onSuccess() {
|
||||
queryClient.invalidateQueries(userKeys.getUser);
|
||||
queryClient.invalidateQueries({ queryKey: userKeys.getUser });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -14,7 +14,7 @@ export const useCreateWebhook = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { workspaceId }) => {
|
||||
queryClient.invalidateQueries(queryKeys.getWebhooks(workspaceId));
|
||||
queryClient.invalidateQueries({ queryKey: queryKeys.getWebhooks(workspaceId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -28,10 +28,10 @@ export const useTestWebhook = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { workspaceId }) => {
|
||||
queryClient.invalidateQueries(queryKeys.getWebhooks(workspaceId));
|
||||
queryClient.invalidateQueries({ queryKey: queryKeys.getWebhooks(workspaceId) });
|
||||
},
|
||||
onError: (_, { workspaceId }) => {
|
||||
queryClient.invalidateQueries(queryKeys.getWebhooks(workspaceId));
|
||||
queryClient.invalidateQueries({ queryKey: queryKeys.getWebhooks(workspaceId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -47,7 +47,7 @@ export const useUpdateWebhook = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { workspaceId }) => {
|
||||
queryClient.invalidateQueries(queryKeys.getWebhooks(workspaceId));
|
||||
queryClient.invalidateQueries({ queryKey: queryKeys.getWebhooks(workspaceId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -61,7 +61,7 @@ export const useDeleteWebhook = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { workspaceId }) => {
|
||||
queryClient.invalidateQueries(queryKeys.getWebhooks(workspaceId));
|
||||
queryClient.invalidateQueries({ queryKey: queryKeys.getWebhooks(workspaceId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -20,8 +20,10 @@ export const useUpdateSlackIntegration = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { orgId, id }) => {
|
||||
queryClient.invalidateQueries(workflowIntegrationKeys.getSlackIntegration(id));
|
||||
queryClient.invalidateQueries(workflowIntegrationKeys.getSlackIntegrations(orgId));
|
||||
queryClient.invalidateQueries({ queryKey: workflowIntegrationKeys.getSlackIntegration(id) });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: workflowIntegrationKeys.getSlackIntegrations(orgId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -36,8 +38,8 @@ export const useDeleteSlackIntegration = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { orgId, id }) => {
|
||||
queryClient.invalidateQueries(workflowIntegrationKeys.getSlackIntegration(id));
|
||||
queryClient.invalidateQueries(workflowIntegrationKeys.getIntegrations(orgId));
|
||||
queryClient.invalidateQueries({ queryKey: workflowIntegrationKeys.getSlackIntegration(id) });
|
||||
queryClient.invalidateQueries({ queryKey: workflowIntegrationKeys.getIntegrations(orgId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -54,7 +56,9 @@ export const useUpdateProjectSlackConfig = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { workspaceId }) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspaceSlackConfig(workspaceId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: workspaceKeys.getWorkspaceSlackConfig(workspaceId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -27,7 +27,9 @@ export const useAddGroupToWorkspace = () => {
|
||||
return groupMembership;
|
||||
},
|
||||
onSuccess: (_, { projectId }) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspaceGroupMemberships(projectId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: workspaceKeys.getWorkspaceGroupMemberships(projectId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -45,7 +47,9 @@ export const useUpdateGroupWorkspaceRole = () => {
|
||||
return groupMembership;
|
||||
},
|
||||
onSuccess: (_, { projectId }) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspaceGroupMemberships(projectId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: workspaceKeys.getWorkspaceGroupMemberships(projectId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -67,10 +71,12 @@ export const useDeleteGroupFromWorkspace = () => {
|
||||
return groupMembership;
|
||||
},
|
||||
onSuccess: (_, { projectId, username }) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspaceGroupMemberships(projectId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: workspaceKeys.getWorkspaceGroupMemberships(projectId)
|
||||
});
|
||||
|
||||
if (username) {
|
||||
queryClient.invalidateQueries(userKeys.listUserGroupMemberships(username));
|
||||
queryClient.invalidateQueries({ queryKey: userKeys.listUserGroupMemberships(username) });
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -83,7 +89,7 @@ export const useLeaveProject = () => {
|
||||
return apiRequest.delete(`/api/v1/workspace/${workspaceId}/leave`);
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getAllUserWorkspace());
|
||||
queryClient.invalidateQueries({ queryKey: workspaceKeys.getAllUserWorkspace() });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -95,7 +101,9 @@ export const useMigrateProjectToV3 = () => {
|
||||
return apiRequest.post(`/api/v1/workspace/${workspaceId}/migrate-v3`);
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getAllUserWorkspace(ProjectType.SecretManager));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: workspaceKeys.getAllUserWorkspace(ProjectType.SecretManager)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -83,14 +83,15 @@ export const useUpgradeProject = () => {
|
||||
});
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getAllUserWorkspace(ProjectType.SecretManager));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: workspaceKeys.getAllUserWorkspace(ProjectType.SecretManager)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export const useGetUpgradeProjectStatus = ({
|
||||
projectId,
|
||||
onSuccess,
|
||||
enabled,
|
||||
refetchInterval
|
||||
}: TGetUpgradeProjectStatusDTO) => {
|
||||
@@ -98,7 +99,6 @@ export const useGetUpgradeProjectStatus = ({
|
||||
queryKey: workspaceKeys.getProjectUpgradeStatus(projectId),
|
||||
queryFn: () => fetchProjectUpgradeStatus(projectId),
|
||||
enabled,
|
||||
onSuccess,
|
||||
refetchInterval
|
||||
});
|
||||
};
|
||||
@@ -151,8 +151,7 @@ export const useGetUserWorkspaces = ({
|
||||
useQuery({
|
||||
queryKey: workspaceKeys.getAllUserWorkspace(type || ""),
|
||||
|
||||
queryFn: () =>
|
||||
fetchUserWorkspaces(includeRoles, type)
|
||||
queryFn: () => fetchUserWorkspaces(includeRoles, type)
|
||||
});
|
||||
|
||||
const fetchUserWorkspaceMemberships = async (orgId: string) => {
|
||||
@@ -180,7 +179,9 @@ export const useNameWorkspaceSecrets = () => {
|
||||
secretsToUpdate
|
||||
}),
|
||||
onSuccess: (_, variables) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspaceIndexStatus(variables.workspaceId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: workspaceKeys.getWorkspaceIndexStatus(variables.workspaceId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -238,7 +239,9 @@ export const useCreateWorkspace = () => {
|
||||
type
|
||||
}),
|
||||
onSuccess: (dto) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getAllUserWorkspace(dto.data.project.type));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: workspaceKeys.getAllUserWorkspace(dto.data.project.type)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -258,7 +261,7 @@ export const useUpdateProject = () => {
|
||||
return data.workspace;
|
||||
},
|
||||
onSuccess: (dto) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getAllUserWorkspace(dto.type));
|
||||
queryClient.invalidateQueries({ queryKey: workspaceKeys.getAllUserWorkspace(dto.type) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -277,7 +280,7 @@ export const useToggleAutoCapitalization = () => {
|
||||
return data.workspace;
|
||||
},
|
||||
onSuccess: (dto) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getAllUserWorkspace(dto.type));
|
||||
queryClient.invalidateQueries({ queryKey: workspaceKeys.getAllUserWorkspace(dto.type) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -293,7 +296,7 @@ export const useUpdateWorkspaceVersionLimit = () => {
|
||||
return data.workspace;
|
||||
},
|
||||
onSuccess: (dto) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getAllUserWorkspace(dto.type));
|
||||
queryClient.invalidateQueries({ queryKey: workspaceKeys.getAllUserWorkspace(dto.type) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -312,7 +315,7 @@ export const useUpdateWorkspaceAuditLogsRetention = () => {
|
||||
return data.workspace;
|
||||
},
|
||||
onSuccess: (dto) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getAllUserWorkspace(dto.type));
|
||||
queryClient.invalidateQueries({ queryKey: workspaceKeys.getAllUserWorkspace(dto.type) });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -326,7 +329,7 @@ export const useDeleteWorkspace = () => {
|
||||
return data.workspace;
|
||||
},
|
||||
onSuccess: (dto) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getAllUserWorkspace(dto.type));
|
||||
queryClient.invalidateQueries({ queryKey: workspaceKeys.getAllUserWorkspace(dto.type) });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: ["org-admin-projects"]
|
||||
});
|
||||
@@ -345,7 +348,9 @@ export const useCreateWsEnvironment = () => {
|
||||
});
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getAllUserWorkspace(ProjectType.SecretManager));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: workspaceKeys.getAllUserWorkspace(ProjectType.SecretManager)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -362,7 +367,9 @@ export const useUpdateWsEnvironment = () => {
|
||||
});
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getAllUserWorkspace(ProjectType.SecretManager));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: workspaceKeys.getAllUserWorkspace(ProjectType.SecretManager)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -375,7 +382,9 @@ export const useDeleteWsEnvironment = () => {
|
||||
return apiRequest.delete(`/api/v1/workspace/${workspaceId}/environments/${id}`);
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getAllUserWorkspace(ProjectType.SecretManager));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: workspaceKeys.getAllUserWorkspace(ProjectType.SecretManager)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -435,8 +444,10 @@ export const useDeleteUserFromWorkspace = () => {
|
||||
return deletedMembership;
|
||||
},
|
||||
onSuccess: (_, { orgId, workspaceId }) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspaceUsers(workspaceId));
|
||||
queryClient.invalidateQueries(userKeys.allOrgMembershipProjectMemberships(orgId));
|
||||
queryClient.invalidateQueries({ queryKey: workspaceKeys.getWorkspaceUsers(workspaceId) });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: userKeys.allOrgMembershipProjectMemberships(orgId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -456,10 +467,10 @@ export const useUpdateUserWorkspaceRole = () => {
|
||||
return membership;
|
||||
},
|
||||
onSuccess: (_, { workspaceId, membershipId }) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspaceUsers(workspaceId));
|
||||
queryClient.invalidateQueries(
|
||||
workspaceKeys.getWorkspaceUserDetails(workspaceId, membershipId)
|
||||
);
|
||||
queryClient.invalidateQueries({ queryKey: workspaceKeys.getWorkspaceUsers(workspaceId) });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: workspaceKeys.getWorkspaceUserDetails(workspaceId, membershipId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -488,8 +499,12 @@ export const useAddIdentityToWorkspace = () => {
|
||||
return identityMembership;
|
||||
},
|
||||
onSuccess: (_, { identityId, workspaceId }) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspaceIdentityMemberships(workspaceId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityProjectMemberships(identityId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: workspaceKeys.getWorkspaceIdentityMemberships(workspaceId)
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: identitiesKeys.getIdentityProjectMemberships(identityId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -510,11 +525,15 @@ export const useUpdateIdentityWorkspaceRole = () => {
|
||||
return identityMembership;
|
||||
},
|
||||
onSuccess: (_, { identityId, workspaceId }) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspaceIdentityMemberships(workspaceId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityProjectMemberships(identityId));
|
||||
queryClient.invalidateQueries(
|
||||
workspaceKeys.getWorkspaceIdentityMembershipDetails(workspaceId, identityId)
|
||||
);
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: workspaceKeys.getWorkspaceIdentityMemberships(workspaceId)
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: identitiesKeys.getIdentityProjectMemberships(identityId)
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: workspaceKeys.getWorkspaceIdentityMembershipDetails(workspaceId, identityId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -537,8 +556,12 @@ export const useDeleteIdentityFromWorkspace = () => {
|
||||
return identityMembership;
|
||||
},
|
||||
onSuccess: (_, { identityId, workspaceId }) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspaceIdentityMemberships(workspaceId));
|
||||
queryClient.invalidateQueries(identitiesKeys.getIdentityProjectMemberships(identityId));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: workspaceKeys.getWorkspaceIdentityMemberships(workspaceId)
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: identitiesKeys.getIdentityProjectMemberships(identityId)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -3,13 +3,12 @@ import { createFileRoute, redirect } from "@tanstack/react-router";
|
||||
import { createNotification } from "@app/components/notifications";
|
||||
import { userKeys } from "@app/hooks/api";
|
||||
import { authKeys, fetchAuthToken } from "@app/hooks/api/auth/queries";
|
||||
import { setAuthToken } from "@app/hooks/api/reactQuery";
|
||||
import { fetchUserDetails } from "@app/hooks/api/users/queries";
|
||||
|
||||
export const Route = createFileRoute("/_authenticate")({
|
||||
beforeLoad: async ({ context }) => {
|
||||
const data = await context.queryClient
|
||||
.fetchQuery({
|
||||
.ensureQueryData({
|
||||
queryKey: authKeys.getAuthToken,
|
||||
queryFn: fetchAuthToken
|
||||
})
|
||||
@@ -24,12 +23,11 @@ export const Route = createFileRoute("/_authenticate")({
|
||||
});
|
||||
});
|
||||
|
||||
setAuthToken(data.token);
|
||||
if (!data.organizationId) {
|
||||
throw redirect({ to: "/login/select-organization" });
|
||||
}
|
||||
|
||||
const user = await context.queryClient.fetchQuery({
|
||||
const user = await context.queryClient.ensureQueryData({
|
||||
queryKey: userKeys.getUser,
|
||||
queryFn: fetchUserDetails
|
||||
});
|
||||
|
||||
@@ -1,41 +1,26 @@
|
||||
import { createMongoAbility, MongoAbility, RawRuleOf } from "@casl/ability";
|
||||
import { unpackRules } from "@casl/ability/extra";
|
||||
import { createFileRoute } from "@tanstack/react-router";
|
||||
|
||||
import { OrgPermissionSet } from "@app/context/OrgPermissionContext/types";
|
||||
import { fetchOrganizationById, organizationKeys } from "@app/hooks/api/organization/queries";
|
||||
import {
|
||||
conditionsMatcher,
|
||||
fetchUserOrgPermissions,
|
||||
roleQueryKeys
|
||||
} from "@app/hooks/api/roles/queries";
|
||||
import { fetchUserOrgPermissions, roleQueryKeys } from "@app/hooks/api/roles/queries";
|
||||
import { fetchOrgSubscription, subscriptionQueryKeys } from "@app/hooks/api/subscriptions/queries";
|
||||
|
||||
export const Route = createFileRoute("/_authenticate/_org_details")({
|
||||
beforeLoad: async ({ context }) => {
|
||||
const organizationId = context.organizationId!;
|
||||
const orgDetails = await context.queryClient.fetchQuery({
|
||||
await context.queryClient.ensureQueryData({
|
||||
queryKey: organizationKeys.getOrgById(organizationId),
|
||||
queryFn: () => fetchOrganizationById(organizationId)
|
||||
});
|
||||
|
||||
const subscription = await context.queryClient.fetchQuery({
|
||||
await context.queryClient.ensureQueryData({
|
||||
queryKey: subscriptionQueryKeys.getOrgSubsription(organizationId),
|
||||
queryFn: () => fetchOrgSubscription(organizationId)
|
||||
});
|
||||
|
||||
const orgPermission = await context.queryClient.fetchQuery({
|
||||
await context.queryClient.ensureQueryData({
|
||||
queryKey: roleQueryKeys.getUserOrgPermissions({ orgId: organizationId }),
|
||||
queryFn: () => fetchUserOrgPermissions({ orgId: organizationId })
|
||||
});
|
||||
|
||||
const rule = unpackRules<RawRuleOf<MongoAbility<OrgPermissionSet>>>(orgPermission.permissions);
|
||||
const ability = createMongoAbility<OrgPermissionSet>(rule, { conditionsMatcher });
|
||||
|
||||
return {
|
||||
organization: orgDetails,
|
||||
subscription,
|
||||
orgPermission: { permission: ability, membership: orgPermission.membership }
|
||||
};
|
||||
return { organizationId };
|
||||
}
|
||||
});
|
||||
|
||||
@@ -43,7 +43,7 @@ export const OrgAdminProjects = withPermission(
|
||||
const navigate = useNavigate();
|
||||
const orgAdminAccessProject = useOrgAdminAccessProject();
|
||||
|
||||
const { data, isLoading: isProjectsLoading } = useOrgAdminGetProjects({
|
||||
const { data, isPending: isProjectsLoading } = useOrgAdminGetProjects({
|
||||
offset: (page - 1) * perPage,
|
||||
limit: perPage,
|
||||
search: debouncedSearch || undefined
|
||||
@@ -130,12 +130,12 @@ export const OrgAdminProjects = withPermission(
|
||||
icon={<FontAwesomeIcon icon={faSignIn} />}
|
||||
disabled={
|
||||
orgAdminAccessProject.variables?.projectId === id &&
|
||||
orgAdminAccessProject.isLoading
|
||||
orgAdminAccessProject.isPending
|
||||
}
|
||||
>
|
||||
Access{" "}
|
||||
{orgAdminAccessProject.variables?.projectId === id &&
|
||||
orgAdminAccessProject.isLoading && <Spinner size="xs" />}
|
||||
orgAdminAccessProject.isPending && <Spinner size="xs" />}
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
|
||||
@@ -61,7 +61,7 @@ export const LogsFilter = ({
|
||||
|
||||
const workspacesInOrg = workspaces.filter((ws) => ws.orgId === currentOrg?.id);
|
||||
|
||||
const { data, isLoading } = useGetAuditLogActorFilterOpts(workspaces?.[0]?.id ?? "");
|
||||
const { data, isPending } = useGetAuditLogActorFilterOpts(workspaces?.[0]?.id ?? "");
|
||||
|
||||
useEffect(() => {
|
||||
if (workspacesInOrg.length) {
|
||||
@@ -205,7 +205,7 @@ export const LogsFilter = ({
|
||||
)}
|
||||
/>
|
||||
|
||||
{!isLoading && data && data.length > 0 && !presets?.actorId && (
|
||||
{!isPending && data && data.length > 0 && !presets?.actorId && (
|
||||
<Controller
|
||||
control={control}
|
||||
name="actor"
|
||||
|
||||
@@ -2,7 +2,7 @@ import { useEffect } from "react";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
|
||||
import { UpgradePlanModal } from "@app/components/v2";
|
||||
import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
|
||||
import { OrgPermissionActions, OrgPermissionSubjects, useSubscription } from "@app/context";
|
||||
import { withPermission } from "@app/hoc";
|
||||
import { ActorType, EventType, UserAgentType } from "@app/hooks/api/auditLogs/enums";
|
||||
|
||||
@@ -44,7 +44,7 @@ export const LogsTable = ({
|
||||
// Use the projectId from the filter if it exists
|
||||
filter?.projectId || null;
|
||||
|
||||
const { data, isLoading, isFetchingNextPage, hasNextPage, fetchNextPage } = useGetAuditLogs(
|
||||
const { data, isPending, isFetchingNextPage, hasNextPage, fetchNextPage } = useGetAuditLogs(
|
||||
{
|
||||
...filter,
|
||||
limit: AUDIT_LOG_LIMIT
|
||||
@@ -55,7 +55,7 @@ export const LogsTable = ({
|
||||
}
|
||||
);
|
||||
|
||||
const isEmpty = !isLoading && !data?.pages?.[0].length;
|
||||
const isEmpty = !isPending && !data?.pages?.[0].length;
|
||||
|
||||
return (
|
||||
<div>
|
||||
@@ -78,7 +78,7 @@ export const LogsTable = ({
|
||||
</Tr>
|
||||
</THead>
|
||||
<TBody>
|
||||
{!isLoading &&
|
||||
{!isPending &&
|
||||
data?.pages?.map((group, i) => (
|
||||
<Fragment key={`audit-log-fragment-${i + 1}`}>
|
||||
{group.map((auditLog) => (
|
||||
@@ -91,7 +91,7 @@ export const LogsTable = ({
|
||||
))}
|
||||
</Fragment>
|
||||
))}
|
||||
{isLoading && <TableSkeleton innerKey="logs-table" columns={5} key="logs" />}
|
||||
{isPending && <TableSkeleton innerKey="logs-table" columns={5} key="logs" />}
|
||||
{isEmpty && (
|
||||
<Tr>
|
||||
<Td colSpan={5}>
|
||||
|
||||
@@ -17,7 +17,7 @@ import { useGetOrgPlanTable } from "@app/hooks/api";
|
||||
|
||||
export const CurrentPlanSection = () => {
|
||||
const { currentOrg } = useOrganization();
|
||||
const { data, isLoading } = useGetOrgPlanTable(currentOrg?.id ?? "");
|
||||
const { data, isPending } = useGetOrgPlanTable(currentOrg?.id ?? "");
|
||||
|
||||
const displayCell = (value: null | number | string | boolean) => {
|
||||
if (value === null) return "-";
|
||||
@@ -44,7 +44,7 @@ export const CurrentPlanSection = () => {
|
||||
</Tr>
|
||||
</THead>
|
||||
<TBody>
|
||||
{!isLoading &&
|
||||
{!isPending &&
|
||||
data &&
|
||||
data?.rows?.length > 0 &&
|
||||
data.rows.map(({ name, allowed, used }) => {
|
||||
@@ -56,8 +56,8 @@ export const CurrentPlanSection = () => {
|
||||
</Tr>
|
||||
);
|
||||
})}
|
||||
{isLoading && <TableSkeleton columns={5} innerKey="invoices" />}
|
||||
{!isLoading && data && data?.rows?.length === 0 && (
|
||||
{isPending && <TableSkeleton columns={5} innerKey="invoices" />}
|
||||
{!isPending && data && data?.rows?.length === 0 && (
|
||||
<Tr>
|
||||
<Td colSpan={3}>
|
||||
<EmptyState title="No plan details found" icon={faFileInvoice} />
|
||||
|
||||
@@ -23,7 +23,7 @@ type Props = {
|
||||
export const ManagePlansTable = ({ billingCycle }: Props) => {
|
||||
const { currentOrg } = useOrganization();
|
||||
const { subscription } = useSubscription();
|
||||
const { data: tableData, isLoading: isTableDataLoading } = useGetOrgPlansTable({
|
||||
const { data: tableData, isPending: isTableDataLoading } = useGetOrgPlansTable({
|
||||
organizationId: currentOrg?.id ?? "",
|
||||
billingCycle
|
||||
});
|
||||
|
||||
@@ -21,7 +21,7 @@ import { ManagePlansModal } from "./ManagePlansModal";
|
||||
export const PreviewSection = () => {
|
||||
const { currentOrg } = useOrganization();
|
||||
const { subscription } = useSubscription();
|
||||
const { data, isLoading } = useGetOrgPlanBillingInfo(currentOrg?.id ?? "");
|
||||
const { data, isPending } = useGetOrgPlanBillingInfo(currentOrg?.id ?? "");
|
||||
const getOrgTrialUrl = useGetOrgTrialUrl();
|
||||
const createCustomerPortalSession = useCreateCustomerPortalSession();
|
||||
|
||||
@@ -124,7 +124,7 @@ export const PreviewSection = () => {
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{!isLoading && subscription && data && (
|
||||
{!isPending && subscription && data && (
|
||||
<div className="mb-6 flex">
|
||||
<div className="mr-4 flex-1 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
|
||||
<p className="mb-2 text-gray-400">Current plan</p>
|
||||
|
||||
@@ -24,7 +24,7 @@ export const CompanyNameSection = () => {
|
||||
resolver: zodResolver(schema)
|
||||
});
|
||||
const { data } = useGetOrgBillingDetails(currentOrg?.id ?? "");
|
||||
const { mutateAsync, isLoading } = useUpdateOrgBillingDetails();
|
||||
const { mutateAsync, isPending } = useUpdateOrgBillingDetails();
|
||||
|
||||
useEffect(() => {
|
||||
if (data) {
|
||||
@@ -79,8 +79,8 @@ export const CompanyNameSection = () => {
|
||||
<Button
|
||||
type="submit"
|
||||
colorSchema="secondary"
|
||||
isLoading={isLoading}
|
||||
isDisabled={isLoading || !isAllowed}
|
||||
isLoading={isPending}
|
||||
isDisabled={isPending || !isAllowed}
|
||||
>
|
||||
Save
|
||||
</Button>
|
||||
|
||||
@@ -24,7 +24,7 @@ export const InvoiceEmailSection = () => {
|
||||
resolver: yupResolver(schema)
|
||||
});
|
||||
const { data } = useGetOrgBillingDetails(currentOrg?.id ?? "");
|
||||
const { mutateAsync, isLoading } = useUpdateOrgBillingDetails();
|
||||
const { mutateAsync, isPending } = useUpdateOrgBillingDetails();
|
||||
|
||||
useEffect(() => {
|
||||
if (data) {
|
||||
@@ -80,8 +80,8 @@ export const InvoiceEmailSection = () => {
|
||||
<Button
|
||||
type="submit"
|
||||
colorSchema="secondary"
|
||||
isLoading={isLoading}
|
||||
isDisabled={isLoading || !isAllowed}
|
||||
isLoading={isPending}
|
||||
isDisabled={isPending || !isAllowed}
|
||||
>
|
||||
Save
|
||||
</Button>
|
||||
|
||||
@@ -10,7 +10,7 @@ import { PmtMethodsTable } from "./PmtMethodsTable";
|
||||
|
||||
export const PmtMethodsSection = () => {
|
||||
const { currentOrg } = useOrganization();
|
||||
const { mutateAsync, isLoading } = useAddOrgPmtMethod();
|
||||
const { mutateAsync, isPending } = useAddOrgPmtMethod();
|
||||
|
||||
const handleAddPmtMethodBtnClick = async () => {
|
||||
if (!currentOrg?.id) return;
|
||||
@@ -32,7 +32,7 @@ export const PmtMethodsSection = () => {
|
||||
<Button
|
||||
onClick={handleAddPmtMethodBtnClick}
|
||||
colorSchema="secondary"
|
||||
isLoading={isLoading}
|
||||
isLoading={isPending}
|
||||
leftIcon={<FontAwesomeIcon icon={faPlus} />}
|
||||
isDisabled={!isAllowed}
|
||||
>
|
||||
|
||||
@@ -22,7 +22,7 @@ import { useDeleteOrgPmtMethod, useGetOrgPmtMethods } from "@app/hooks/api";
|
||||
|
||||
export const PmtMethodsTable = () => {
|
||||
const { currentOrg } = useOrganization();
|
||||
const { data, isLoading } = useGetOrgPmtMethods(currentOrg?.id ?? "");
|
||||
const { data, isPending } = useGetOrgPmtMethods(currentOrg?.id ?? "");
|
||||
const deleteOrgPmtMethod = useDeleteOrgPmtMethod();
|
||||
const { handlePopUpOpen, handlePopUpClose, handlePopUpToggle, popUp } = usePopUp([
|
||||
"removeCard"
|
||||
@@ -64,7 +64,7 @@ export const PmtMethodsTable = () => {
|
||||
</Tr>
|
||||
</THead>
|
||||
<TBody>
|
||||
{!isLoading &&
|
||||
{!isPending &&
|
||||
data &&
|
||||
data?.length > 0 &&
|
||||
data.map(({ _id: id, brand, exp_month, exp_year, funding, last4 }) => (
|
||||
@@ -94,8 +94,8 @@ export const PmtMethodsTable = () => {
|
||||
</Td>
|
||||
</Tr>
|
||||
))}
|
||||
{isLoading && <TableSkeleton columns={5} innerKey="pmt-methods" />}
|
||||
{!isLoading && data && data?.length === 0 && (
|
||||
{isPending && <TableSkeleton columns={5} innerKey="pmt-methods" />}
|
||||
{!isPending && data && data?.length === 0 && (
|
||||
<Tr>
|
||||
<Td colSpan={5}>
|
||||
<EmptyState title="No payment methods on file" icon={faCreditCard} />
|
||||
|
||||
@@ -72,7 +72,7 @@ const taxIDTypeLabelMap: { [key: string]: string } = {
|
||||
|
||||
export const TaxIDTable = () => {
|
||||
const { currentOrg } = useOrganization();
|
||||
const { data, isLoading } = useGetOrgTaxIds(currentOrg?.id ?? "");
|
||||
const { data, isPending } = useGetOrgTaxIds(currentOrg?.id ?? "");
|
||||
const deleteOrgTaxId = useDeleteOrgTaxId();
|
||||
|
||||
const handleDeleteTaxIdBtnClick = async (taxId: string) => {
|
||||
@@ -94,7 +94,7 @@ export const TaxIDTable = () => {
|
||||
</Tr>
|
||||
</THead>
|
||||
<TBody>
|
||||
{!isLoading &&
|
||||
{!isPending &&
|
||||
data &&
|
||||
data?.length > 0 &&
|
||||
data.map(({ id, type, value }) => (
|
||||
@@ -124,8 +124,8 @@ export const TaxIDTable = () => {
|
||||
</Td>
|
||||
</Tr>
|
||||
))}
|
||||
{isLoading && <TableSkeleton columns={3} innerKey="tax-ids" />}
|
||||
{!isLoading && data && data?.length === 0 && (
|
||||
{isPending && <TableSkeleton columns={3} innerKey="tax-ids" />}
|
||||
{!isPending && data && data?.length === 0 && (
|
||||
<Tr>
|
||||
<Td colSpan={5}>
|
||||
<EmptyState title="No Tax IDs on file" icon={faFileInvoice} />
|
||||
|
||||
@@ -18,7 +18,7 @@ import { useGetOrgInvoices } from "@app/hooks/api";
|
||||
|
||||
export const InvoicesTable = () => {
|
||||
const { currentOrg } = useOrganization();
|
||||
const { data, isLoading } = useGetOrgInvoices(currentOrg?.id ?? "");
|
||||
const { data, isPending } = useGetOrgInvoices(currentOrg?.id ?? "");
|
||||
return (
|
||||
<TableContainer className="mt-8">
|
||||
<Table>
|
||||
@@ -32,7 +32,7 @@ export const InvoicesTable = () => {
|
||||
</Tr>
|
||||
</THead>
|
||||
<TBody>
|
||||
{!isLoading &&
|
||||
{!isPending &&
|
||||
data &&
|
||||
data?.length > 0 &&
|
||||
data.map(({ id, created, paid, number, total, invoice_pdf }) => {
|
||||
@@ -65,8 +65,8 @@ export const InvoicesTable = () => {
|
||||
</Tr>
|
||||
);
|
||||
})}
|
||||
{isLoading && <TableSkeleton columns={5} innerKey="invoices" />}
|
||||
{!isLoading && data && data?.length === 0 && (
|
||||
{isPending && <TableSkeleton columns={5} innerKey="invoices" />}
|
||||
{!isPending && data && data?.length === 0 && (
|
||||
<Tr>
|
||||
<Td colSpan={5}>
|
||||
<EmptyState title="No invoices on file" icon={faFileInvoice} />
|
||||
|
||||
@@ -16,7 +16,7 @@ import { useGetOrgLicenses } from "@app/hooks/api";
|
||||
|
||||
export const LicensesSection = () => {
|
||||
const { currentOrg } = useOrganization();
|
||||
const { data, isLoading } = useGetOrgLicenses(currentOrg?.id ?? "");
|
||||
const { data, isPending } = useGetOrgLicenses(currentOrg?.id ?? "");
|
||||
|
||||
return (
|
||||
<div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
|
||||
@@ -32,7 +32,7 @@ export const LicensesSection = () => {
|
||||
</Tr>
|
||||
</THead>
|
||||
<TBody>
|
||||
{!isLoading &&
|
||||
{!isPending &&
|
||||
data &&
|
||||
data?.length > 0 &&
|
||||
data.map(({ id, licenseKey, isActivated, createdAt, expiresAt }) => {
|
||||
@@ -47,8 +47,8 @@ export const LicensesSection = () => {
|
||||
</Tr>
|
||||
);
|
||||
})}
|
||||
{isLoading && <TableSkeleton columns={4} innerKey="licenses" />}
|
||||
{!isLoading && data && data?.length === 0 && (
|
||||
{isPending && <TableSkeleton columns={4} innerKey="licenses" />}
|
||||
{!isPending && data && data?.length === 0 && (
|
||||
<Tr>
|
||||
<Td colSpan={4}>
|
||||
<EmptyState title="No enterprise licenses on file" icon={faFileContract} />
|
||||
|
||||
@@ -43,7 +43,7 @@ export const AddGroupMembersModal = ({ popUp, handlePopUpToggle }: Props) => {
|
||||
};
|
||||
|
||||
const offset = (page - 1) * perPage;
|
||||
const { data, isLoading } = useListGroupUsers({
|
||||
const { data, isPending } = useListGroupUsers({
|
||||
id: popUpData?.groupId,
|
||||
groupSlug: popUpData?.slug,
|
||||
offset,
|
||||
@@ -113,8 +113,8 @@ export const AddGroupMembersModal = ({ popUp, handlePopUpToggle }: Props) => {
|
||||
</Tr>
|
||||
</THead>
|
||||
<TBody>
|
||||
{isLoading && <TableSkeleton columns={2} innerKey="group-users" />}
|
||||
{!isLoading &&
|
||||
{isPending && <TableSkeleton columns={2} innerKey="group-users" />}
|
||||
{!isPending &&
|
||||
data?.users?.map(({ id, firstName, lastName, username }) => {
|
||||
return (
|
||||
<Tr className="items-center" key={`group-user-${id}`}>
|
||||
@@ -130,7 +130,7 @@ export const AddGroupMembersModal = ({ popUp, handlePopUpToggle }: Props) => {
|
||||
{(isAllowed) => {
|
||||
return (
|
||||
<Button
|
||||
isLoading={isLoading}
|
||||
isLoading={isPending}
|
||||
isDisabled={!isAllowed}
|
||||
colorSchema="primary"
|
||||
variant="outline_bg"
|
||||
@@ -148,7 +148,7 @@ export const AddGroupMembersModal = ({ popUp, handlePopUpToggle }: Props) => {
|
||||
})}
|
||||
</TBody>
|
||||
</Table>
|
||||
{!isLoading && totalCount > 0 && (
|
||||
{!isPending && totalCount > 0 && (
|
||||
<Pagination
|
||||
count={totalCount}
|
||||
page={page}
|
||||
@@ -157,7 +157,7 @@ export const AddGroupMembersModal = ({ popUp, handlePopUpToggle }: Props) => {
|
||||
onChangePerPage={(newPerPage) => setPerPage(newPerPage)}
|
||||
/>
|
||||
)}
|
||||
{!isLoading && !data?.users?.length && (
|
||||
{!isPending && !data?.users?.length && (
|
||||
<EmptyState
|
||||
title={
|
||||
debouncedSearch ? "No users match search" : "All users are already in the group"
|
||||
|
||||
@@ -40,8 +40,8 @@ type Props = {
|
||||
export const GroupCreateUpdateModal = ({ popUp, handlePopUpClose, handlePopUpToggle }: Props) => {
|
||||
const { currentOrg } = useOrganization();
|
||||
const { data: roles } = useGetOrgRoles(currentOrg?.id || "");
|
||||
const { mutateAsync: createMutateAsync, isLoading: createIsLoading } = useCreateGroup();
|
||||
const { mutateAsync: updateMutateAsync, isLoading: updateIsLoading } = useUpdateGroup();
|
||||
const { mutateAsync: createMutateAsync, isPending: createIsLoading } = useCreateGroup();
|
||||
const { mutateAsync: updateMutateAsync, isPending: updateIsLoading } = useUpdateGroup();
|
||||
|
||||
const { control, handleSubmit, reset } = useForm<TGroupFormData>({
|
||||
resolver: zodResolver(GroupFormSchema)
|
||||
|
||||
@@ -14,9 +14,9 @@ type Props = {
|
||||
};
|
||||
|
||||
export const GroupDetailsSection = ({ groupId, handlePopUpOpen }: Props) => {
|
||||
const { data, isLoading } = useGetGroupById(groupId);
|
||||
const { data, isPending } = useGetGroupById(groupId);
|
||||
|
||||
if (isLoading) return <Spinner size="sm" className="ml-2 mt-2" />;
|
||||
if (isPending) return <Spinner size="sm" className="ml-2 mt-2" />;
|
||||
|
||||
return data ? (
|
||||
<div className="rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
|
||||
|
||||
@@ -58,7 +58,7 @@ export const GroupMembersTable = ({ groupId, groupSlug, handlePopUpOpen }: Props
|
||||
toggleOrderDirection
|
||||
} = usePagination(GroupMembersOrderBy.Name, { initPerPage: 10 });
|
||||
|
||||
const { data: groupMemberships, isLoading } = useListGroupUsers({
|
||||
const { data: groupMemberships, isPending } = useListGroupUsers({
|
||||
id: groupId,
|
||||
groupSlug,
|
||||
offset,
|
||||
@@ -138,8 +138,8 @@ export const GroupMembersTable = ({ groupId, groupSlug, handlePopUpOpen }: Props
|
||||
</Tr>
|
||||
</THead>
|
||||
<TBody>
|
||||
{isLoading && <TableSkeleton columns={4} innerKey="group-user-memberships" />}
|
||||
{!isLoading &&
|
||||
{isPending && <TableSkeleton columns={4} innerKey="group-user-memberships" />}
|
||||
{!isPending &&
|
||||
filteredGroupMemberships.slice(offset, perPage * page).map((userGroupMembership) => {
|
||||
return (
|
||||
<GroupMembershipRow
|
||||
@@ -160,7 +160,7 @@ export const GroupMembersTable = ({ groupId, groupSlug, handlePopUpOpen }: Props
|
||||
onChangePerPage={setPerPage}
|
||||
/>
|
||||
)}
|
||||
{!isLoading && !filteredGroupMemberships?.length && (
|
||||
{!isPending && !filteredGroupMemberships?.length && (
|
||||
<EmptyState
|
||||
title={
|
||||
groupMemberships?.users.length
|
||||
|
||||
@@ -5,6 +5,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
import { createFileRoute, useNavigate, useParams } from "@tanstack/react-router";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
|
||||
import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
|
||||
import { createNotification } from "@app/components/notifications";
|
||||
import { OrgPermissionCan } from "@app/components/permissions";
|
||||
import {
|
||||
@@ -15,8 +16,7 @@ import {
|
||||
DropdownMenuItem,
|
||||
DropdownMenuTrigger,
|
||||
Spinner,
|
||||
Tooltip,
|
||||
UpgradePlanModal
|
||||
Tooltip
|
||||
} from "@app/components/v2";
|
||||
import { OrgPermissionActions, OrgPermissionSubjects, useOrganization } from "@app/context";
|
||||
import { withPermission } from "@app/hoc";
|
||||
@@ -44,7 +44,7 @@ const GroupPage = withPermission(
|
||||
const groupId = params.groupId as string;
|
||||
const { currentOrg } = useOrganization();
|
||||
|
||||
const { data, isLoading } = useGetGroupById(groupId);
|
||||
const { data, isPending } = useGetGroupById(groupId);
|
||||
|
||||
const { mutateAsync: deleteMutateAsync } = useDeleteGroup();
|
||||
|
||||
@@ -83,7 +83,7 @@ const GroupPage = withPermission(
|
||||
handlePopUpClose("deleteGroup");
|
||||
};
|
||||
|
||||
if (isLoading) return <Spinner size="sm" className="ml-2 mt-2" />;
|
||||
if (isPending) return <Spinner size="sm" className="ml-2 mt-2" />;
|
||||
|
||||
return (
|
||||
<div className="container mx-auto flex flex-col justify-between bg-bunker-800 text-white">
|
||||
|
||||
@@ -58,8 +58,8 @@ const Content = ({ identityId, handlePopUpToggle }: Omit<Props, "popUp">) => {
|
||||
|
||||
const projectId = watch("project")?.id;
|
||||
const { data: projectMemberships } = useGetIdentityProjectMemberships(identityId);
|
||||
const { data: project, isLoading: isProjectLoading } = useGetWorkspaceById(projectId);
|
||||
const { data: roles, isLoading: isRolesLoading } = useGetProjectRoles(project?.id ?? "");
|
||||
const { data: project, isPending: isProjectLoading } = useGetWorkspaceById(projectId);
|
||||
const { data: roles, isPending: isRolesLoading } = useGetProjectRoles(project?.id ?? "");
|
||||
|
||||
const filteredWorkspaces = useMemo(() => {
|
||||
const wsWorkspaceIds = new Map();
|
||||
|
||||
@@ -41,7 +41,7 @@ enum IdentityProjectsOrderBy {
|
||||
}
|
||||
|
||||
export const IdentityProjectsTable = ({ identityId, handlePopUpOpen }: Props) => {
|
||||
const { data: projectMemberships = [], isLoading } = useGetIdentityProjectMemberships(identityId);
|
||||
const { data: projectMemberships = [], isPending } = useGetIdentityProjectMemberships(identityId);
|
||||
|
||||
const {
|
||||
search,
|
||||
@@ -113,8 +113,8 @@ export const IdentityProjectsTable = ({ identityId, handlePopUpOpen }: Props) =>
|
||||
</Tr>
|
||||
</THead>
|
||||
<TBody>
|
||||
{isLoading && <TableSkeleton columns={4} innerKey="identity-project-memberships" />}
|
||||
{!isLoading &&
|
||||
{isPending && <TableSkeleton columns={4} innerKey="identity-project-memberships" />}
|
||||
{!isPending &&
|
||||
filteredProjectMemberships.slice(offset, perPage * page).map((membership) => {
|
||||
return (
|
||||
<IdentityProjectRow
|
||||
@@ -135,7 +135,7 @@ export const IdentityProjectsTable = ({ identityId, handlePopUpOpen }: Props) =>
|
||||
onChangePerPage={setPerPage}
|
||||
/>
|
||||
)}
|
||||
{!isLoading && !filteredProjectMemberships?.length && (
|
||||
{!isPending && !filteredProjectMemberships?.length && (
|
||||
<EmptyState
|
||||
title={
|
||||
projectMemberships.length
|
||||
|
||||
@@ -61,7 +61,7 @@ export const IdentityTokenListModal = ({ popUp, handlePopUpOpen, handlePopUpTogg
|
||||
};
|
||||
|
||||
const { data: tokens } = useGetIdentityTokensTokenAuth(popUpData?.identityId ?? "");
|
||||
const { data, isLoading } = useGetIdentityUniversalAuthClientSecrets(popUpData?.identityId ?? "");
|
||||
const { data, isPending } = useGetIdentityUniversalAuthClientSecrets(popUpData?.identityId ?? "");
|
||||
|
||||
const { mutateAsync: createToken } = useCreateTokenIdentityTokenAuth();
|
||||
|
||||
@@ -202,8 +202,8 @@ export const IdentityTokenListModal = ({ popUp, handlePopUpOpen, handlePopUpTogg
|
||||
</Tr>
|
||||
</THead>
|
||||
<TBody>
|
||||
{isLoading && <TableSkeleton columns={5} innerKey="identities-tokens" />}
|
||||
{!isLoading &&
|
||||
{isPending && <TableSkeleton columns={5} innerKey="identities-tokens" />}
|
||||
{!isPending &&
|
||||
tokens?.map(
|
||||
({
|
||||
id,
|
||||
@@ -251,7 +251,7 @@ export const IdentityTokenListModal = ({ popUp, handlePopUpOpen, handlePopUpTogg
|
||||
);
|
||||
}
|
||||
)}
|
||||
{!isLoading && data && data?.length === 0 && (
|
||||
{!isPending && data && data?.length === 0 && (
|
||||
<Tr>
|
||||
<Td colSpan={5}>
|
||||
<EmptyState
|
||||
|
||||
@@ -7,6 +7,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
import { createFileRoute, useNavigate, useParams } from "@tanstack/react-router";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
|
||||
import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
|
||||
import { createNotification } from "@app/components/notifications";
|
||||
import { OrgPermissionCan } from "@app/components/permissions";
|
||||
import {
|
||||
@@ -16,8 +17,7 @@ import {
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuTrigger,
|
||||
Tooltip,
|
||||
UpgradePlanModal
|
||||
Tooltip
|
||||
} from "@app/components/v2";
|
||||
import { OrgPermissionActions, OrgPermissionSubjects, useOrganization } from "@app/context";
|
||||
import { withPermission } from "@app/hoc";
|
||||
|
||||
@@ -37,8 +37,8 @@ type Props = {
|
||||
export const OrgGroupModal = ({ popUp, handlePopUpClose, handlePopUpToggle }: Props) => {
|
||||
const { currentOrg } = useOrganization();
|
||||
const { data: roles } = useGetOrgRoles(currentOrg?.id || "");
|
||||
const { mutateAsync: createMutateAsync, isLoading: createIsLoading } = useCreateGroup();
|
||||
const { mutateAsync: updateMutateAsync, isLoading: updateIsLoading } = useUpdateGroup();
|
||||
const { mutateAsync: createMutateAsync, isPending: createIsLoading } = useCreateGroup();
|
||||
const { mutateAsync: updateMutateAsync, isPending: updateIsLoading } = useUpdateGroup();
|
||||
|
||||
const { control, handleSubmit, reset } = useForm<TGroupFormData>({
|
||||
resolver: zodResolver(GroupFormSchema)
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { faPlus } from "@fortawesome/free-solid-svg-icons";
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
|
||||
import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
|
||||
import { createNotification } from "@app/components/notifications";
|
||||
import { OrgPermissionCan } from "@app/components/permissions";
|
||||
import { Button, DeleteActionModal, UpgradePlanModal } from "@app/components/v2";
|
||||
import { Button, DeleteActionModal } from "@app/components/v2";
|
||||
import { OrgPermissionActions, OrgPermissionSubjects, useSubscription } from "@app/context";
|
||||
import { useDeleteGroup } from "@app/hooks/api";
|
||||
import { usePopUp } from "@app/hooks/usePopUp";
|
||||
|
||||
@@ -65,7 +65,7 @@ export const OrgGroupsTable = ({ handlePopUpOpen }: Props) => {
|
||||
const navigate = useNavigate();
|
||||
const { currentOrg } = useOrganization();
|
||||
const orgId = currentOrg?.id || "";
|
||||
const { isLoading, data: groups = [] } = useGetOrganizationGroups(orgId);
|
||||
const { isPending, data: groups = [] } = useGetOrganizationGroups(orgId);
|
||||
const { mutateAsync: updateMutateAsync } = useUpdateGroup();
|
||||
|
||||
const { data: roles } = useGetOrgRoles(orgId);
|
||||
@@ -219,8 +219,8 @@ export const OrgGroupsTable = ({ handlePopUpOpen }: Props) => {
|
||||
</Tr>
|
||||
</THead>
|
||||
<TBody>
|
||||
{isLoading && <TableSkeleton columns={4} innerKey="org-groups" />}
|
||||
{!isLoading &&
|
||||
{isPending && <TableSkeleton columns={4} innerKey="org-groups" />}
|
||||
{!isPending &&
|
||||
filteredGroups
|
||||
.slice(offset, perPage * page)
|
||||
.map(({ id, name, slug, role, customRole }) => {
|
||||
@@ -381,7 +381,7 @@ export const OrgGroupsTable = ({ handlePopUpOpen }: Props) => {
|
||||
onChangePerPage={setPerPage}
|
||||
/>
|
||||
)}
|
||||
{!isLoading && !filteredGroups?.length && (
|
||||
{!isPending && !filteredGroups?.length && (
|
||||
<EmptyState
|
||||
title={
|
||||
groups.length
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user