mirror of
https://github.com/khairul169/vaulterm.git
synced 2026-09-15 17:03:30 +07:00
feat: update
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||
import { FormSchema } from "../schema/form";
|
||||
import api, { queryClient } from "@/lib/api";
|
||||
import { useMemo } from "react";
|
||||
|
||||
export const useKeychains = () => {
|
||||
return useQuery({
|
||||
@@ -10,6 +11,22 @@ export const useKeychains = () => {
|
||||
});
|
||||
};
|
||||
|
||||
export const useKeychainsOptions = () => {
|
||||
const keys = useKeychains();
|
||||
|
||||
const data = useMemo(() => {
|
||||
const items: any[] = keys.data || [];
|
||||
|
||||
return items.map((key: any) => ({
|
||||
type: key.type,
|
||||
label: key.label,
|
||||
value: key.id,
|
||||
}));
|
||||
}, [keys.data]);
|
||||
|
||||
return data;
|
||||
};
|
||||
|
||||
export const useSaveHost = () => {
|
||||
return useMutation({
|
||||
mutationFn: async (body: FormSchema) => {
|
||||
|
||||
Reference in New Issue
Block a user