Update permission logic

This commit is contained in:
Tuan Dang
2025-04-08 18:45:16 -07:00
parent 728c3f56a7
commit 20ebfcefaa
11 changed files with 109 additions and 63 deletions
+1 -1
View File
@@ -1,2 +1,2 @@
export { useCreateSshHost, useDeleteSshHost, useUpdateSshHost } from "./mutations";
export { useGetSshHostById } from "./queries";
export { fetchSshHostUserCaPublicKey, useGetSshHostById } from "./queries";
+9 -1
View File
@@ -5,7 +5,8 @@ import { apiRequest } from "@app/config/request";
import { TSshHost } from "./types";
export const sshHostKeys = {
getSshHostById: (sshHostId: string) => [{ sshHostId }, "ssh-host"]
getSshHostById: (sshHostId: string) => [{ sshHostId }, "ssh-host"],
getSshHostUserCaPublicKey: (sshHostId: string) => [{ sshHostId }, "ssh-host-user-ca-public-key"]
};
export const useGetSshHostById = (sshHostId: string) => {
@@ -18,3 +19,10 @@ export const useGetSshHostById = (sshHostId: string) => {
enabled: Boolean(sshHostId)
});
};
export const fetchSshHostUserCaPublicKey = async (sshHostId: string): Promise<string> => {
const { data } = await apiRequest.get<string>(
`/api/v1/ssh/hosts/${sshHostId}/user-ca-public-key`
);
return data;
};