mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-16 06:45:28 +00:00
Finish basic scaffolding for service token v3
This commit is contained in:
@@ -6,6 +6,7 @@ import { IntegrationAuth } from "../integrationAuth/types";
|
||||
import { TIntegration } from "../integrations/types";
|
||||
import { EncryptedSecret } from "../secrets/types";
|
||||
import { TWorkspaceUser } from "../users/types";
|
||||
import { ServiceTokenDataV3 } from "../serviceTokens/types";
|
||||
import {
|
||||
CreateEnvironmentDTO,
|
||||
CreateWorkspaceDTO,
|
||||
@@ -32,7 +33,8 @@ export const workspaceKeys = {
|
||||
getAllUserWorkspace: ["workspaces"] as const,
|
||||
getUserWsEnvironments: (workspaceId: string) => ["workspace-env", { workspaceId }] as const,
|
||||
getWorkspaceAuditLogs: (workspaceId: string) => [{ workspaceId }] as const,
|
||||
getWorkspaceUsers: (workspaceId: string) => [{ workspaceId }] as const
|
||||
getWorkspaceUsers: (workspaceId: string) => [{ workspaceId }] as const,
|
||||
getWorkspaceServiceTokenDataV3: (workspaceId: string) => [{ workspaceId }, "workspace-service-token-data-v3"] as const
|
||||
};
|
||||
|
||||
const fetchWorkspaceById = async (workspaceId: string) => {
|
||||
@@ -361,3 +363,19 @@ export const useUpdateUserWorkspaceRole = () => {
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export const useGetWorkspaceServiceTokenDataV3 = (workspaceId: string) => {
|
||||
return useQuery({
|
||||
queryKey: workspaceKeys.getWorkspaceServiceTokenDataV3(workspaceId),
|
||||
queryFn: async () => {
|
||||
const {
|
||||
data: { serviceTokenData }
|
||||
} = await apiRequest.get<{ serviceTokenData: ServiceTokenDataV3[] }>(
|
||||
`/api/v3/workspaces/${workspaceId}/service-token`
|
||||
);
|
||||
|
||||
return serviceTokenData;
|
||||
},
|
||||
enabled: true
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user