Begin frontend for GCP IAM Auth

This commit is contained in:
Tuan Dang
2024-05-07 12:40:19 -07:00
parent e96ca8d355
commit 1d40d9e448
7 changed files with 479 additions and 21 deletions
+18 -2
View File
@@ -2,13 +2,14 @@ import { useQuery } from "@tanstack/react-query";
import { apiRequest } from "@app/config/request";
import { ClientSecretData, IdentityUniversalAuth } from "./types";
import { ClientSecretData, IdentityGcpIamAuth,IdentityUniversalAuth } from "./types";
export const identitiesKeys = {
getIdentityUniversalAuth: (identityId: string) =>
[{ identityId }, "identity-universal-auth"] as const,
getIdentityUniversalAuthClientSecrets: (identityId: string) =>
[{ identityId }, "identity-universal-auth-client-secrets"] as const
[{ identityId }, "identity-universal-auth-client-secrets"] as const,
getIdentityGcpIamAuth: (identityId: string) => [{ identityId }, "identity-gcp-iam-auth"] as const
};
export const useGetIdentityUniversalAuth = (identityId: string) => {
@@ -44,3 +45,18 @@ export const useGetIdentityUniversalAuthClientSecrets = (identityId: string) =>
}
});
};
export const useGetIdentityGcpIamAuth = (identityId: string) => {
return useQuery({
enabled: Boolean(identityId),
queryKey: identitiesKeys.getIdentityGcpIamAuth(identityId),
queryFn: async () => {
const {
data: { identityGcpIamAuth }
} = await apiRequest.get<{ identityGcpIamAuth: IdentityGcpIamAuth }>(
`/api/v1/auth/gcp-iam-auth/identities/${identityId}`
);
return identityGcpIamAuth;
}
});
};