chore: Refactor and improve UI

This commit is contained in:
Meet
2024-09-20 12:29:26 +05:30
parent 040fa511f6
commit 10574bfe26
7 changed files with 169 additions and 215 deletions
+12 -16
View File
@@ -6,7 +6,6 @@ import { apiRequest } from "@app/config/request";
import {
TDetailsDynamicSecretDTO,
TDynamicSecret,
TDynamicSecretProvider,
TGetDynamicSecretsByEnvsDTO,
TListDynamicSecretDTO
} from "./types";
@@ -22,12 +21,6 @@ export const dynamicSecretKeys = {
[{ projectSlug, path, environmentSlug, name }, "dynamic-secret-details"] as const
};
type EntraIDUser = {
name: string;
id: string;
email: string;
};
export const useGetDynamicSecrets = ({
projectSlug,
environmentSlug,
@@ -79,25 +72,28 @@ export const useGetDynamicSecretDetails = ({
};
export const useGetDynamicSecretProviderData = ({
provider,
dataFetchType,
tenantId,
applicationId,
clientSecret,
enabled
}: {
provider: TDynamicSecretProvider,
dataFetchType: "Users",
tenantId: string;
applicationId: string;
clientSecret: string;
enabled: boolean
}) => {
return useQuery({
queryKey: ["users"],
queryFn: async () => {
const { data } = await apiRequest.post<{ data: { users: [EntraIDUser] } }>(
"/api/v1/dynamic-secrets/fetch-provider-data",
const { data } = await apiRequest.post<{id:string, email: string, name:string}[]>(
"/api/v1/dynamic-secrets/entra-id/users",
{
provider,
dataFetchType
tenantId,
applicationId,
clientSecret
}
);
return data.data.users;
return data;
},
enabled
});