feat: added gateway page in ui for org

This commit is contained in:
=
2025-02-26 20:45:36 +05:30
parent 4bbe80c083
commit 7905017121
14 changed files with 504 additions and 4 deletions
@@ -0,0 +1,2 @@
export { useDeleteGateway } from "./mutation";
export { gatewaysQueryKeys } from "./queries";
@@ -0,0 +1,15 @@
import { apiRequest } from "@app/config/request";
import { useMutation, useQueryClient } from "@tanstack/react-query";
import { gatewaysQueryKeys } from "./queries";
export const useDeleteGateway = () => {
const queryClient = useQueryClient();
return useMutation({
mutationFn: (id: string) => {
return apiRequest.delete(`/api/v1/gateways/${id}`);
},
onSuccess: () => {
queryClient.invalidateQueries(gatewaysQueryKeys.list());
}
});
};
@@ -0,0 +1,16 @@
import { apiRequest } from "@app/config/request";
import { queryOptions } from "@tanstack/react-query";
import { TGateway } from "./types";
export const gatewaysQueryKeys = {
allKey: () => ["gateways"],
listKey: () => [...gatewaysQueryKeys.allKey(), "list"],
list: () =>
queryOptions({
queryKey: gatewaysQueryKeys.listKey(),
queryFn: async () => {
const { data } = await apiRequest.get<{ gateways: TGateway[] }>("/api/v1/gateways");
return data.gateways;
}
})
};
+17
View File
@@ -0,0 +1,17 @@
export type TGateway = {
id: string;
identityId: string;
name: string;
createdAt: string;
updatedAt: string;
issuedAt: string;
serialNumber: string;
identity: {
name: string;
id: string;
};
};
export type TDeleteGatewayDTO = {
id: string;
};
+1
View File
@@ -10,6 +10,7 @@ export * from "./certificates";
export * from "./certificateTemplates";
export * from "./dynamicSecret";
export * from "./dynamicSecretLease";
export * from "./gateways";
export * from "./groups";
export * from "./identities";
export * from "./identityProjectAdditionalPrivilege";