mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-13 14:29:35 +00:00
feat: gateway registration + start of gateway v2 integration
This commit is contained in:
@@ -0,0 +1 @@
|
||||
export { gatewaysV2QueryKeys } from "./queries";
|
||||
@@ -0,0 +1,18 @@
|
||||
import { queryOptions } from "@tanstack/react-query";
|
||||
|
||||
import { apiRequest } from "@app/config/request";
|
||||
|
||||
import { TGatewayV2 } from "./types";
|
||||
|
||||
export const gatewaysV2QueryKeys = {
|
||||
allKey: () => ["gateways-v2"],
|
||||
listKey: () => [...gatewaysV2QueryKeys.allKey(), "list"],
|
||||
list: () =>
|
||||
queryOptions({
|
||||
queryKey: gatewaysV2QueryKeys.listKey(),
|
||||
queryFn: async () => {
|
||||
const { data } = await apiRequest.get<{ gateways: TGatewayV2[] }>("/api/v2/gateways");
|
||||
return data.gateways;
|
||||
}
|
||||
})
|
||||
};
|
||||
@@ -0,0 +1,11 @@
|
||||
export type TGatewayV2 = {
|
||||
id: string;
|
||||
identityId: string;
|
||||
name: string;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
identity: {
|
||||
name: string;
|
||||
id: string;
|
||||
};
|
||||
};
|
||||
@@ -2,6 +2,7 @@ import { queryOptions } from "@tanstack/react-query";
|
||||
|
||||
import { apiRequest } from "@app/config/request";
|
||||
|
||||
import { TGatewayV2 } from "../gateways-v2/types";
|
||||
import { TGateway } from "./types";
|
||||
|
||||
export const gatewaysQueryKeys = {
|
||||
@@ -12,7 +13,9 @@ export const gatewaysQueryKeys = {
|
||||
queryKey: gatewaysQueryKeys.listKey(),
|
||||
queryFn: async () => {
|
||||
const { data } = await apiRequest.get<{ gateways: TGateway[] }>("/api/v1/gateways");
|
||||
return data.gateways;
|
||||
const { data: dataV2 } = await apiRequest.get<TGatewayV2[]>("/api/v2/gateways");
|
||||
|
||||
return [...data.gateways, ...dataV2];
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user