tiny greptile improvement

This commit is contained in:
x032205
2025-10-20 21:34:28 -04:00
parent 8bbddb09c0
commit df069cbd5b
+7 -2
View File
@@ -13,7 +13,12 @@ export const pamKeys = {
session: () => [...pamKeys.all, "session"] as const, session: () => [...pamKeys.all, "session"] as const,
listResourceOptions: () => [...pamKeys.resource(), "options"] as const, listResourceOptions: () => [...pamKeys.resource(), "options"] as const,
listResources: (projectId: string) => [...pamKeys.resource(), "list", projectId], listResources: (projectId: string) => [...pamKeys.resource(), "list", projectId],
getResource: (resourceId: string) => [...pamKeys.resource(), "get", resourceId], getResource: (resourceType: string, resourceId: string) => [
...pamKeys.resource(),
"get",
resourceType,
resourceId
],
listAccounts: (projectId: string) => [...pamKeys.account(), "list", projectId], listAccounts: (projectId: string) => [...pamKeys.account(), "list", projectId],
getSession: (sessionId: string) => [...pamKeys.session(), "get", sessionId], getSession: (sessionId: string) => [...pamKeys.session(), "get", sessionId],
listSessions: (projectId: string) => [...pamKeys.session(), "list", projectId] listSessions: (projectId: string) => [...pamKeys.session(), "list", projectId]
@@ -79,7 +84,7 @@ export const useGetPamResourceById = (
> >
) => { ) => {
return useQuery({ return useQuery({
queryKey: pamKeys.getResource(resourceId || ""), queryKey: pamKeys.getResource(resourceType || "", resourceId || ""),
queryFn: async () => { queryFn: async () => {
const { data } = await apiRequest.get<{ resource: TPamResource }>( const { data } = await apiRequest.get<{ resource: TPamResource }>(
`/api/v1/pam/resources/${resourceType}/${resourceId}` `/api/v1/pam/resources/${resourceType}/${resourceId}`