better-chatbot / src /hooks /queries /use-workflow-tool-list.ts
Bot
Initial commit for HF Spaces
05c5ed5
Raw
History Blame Contribute Delete
486 Bytes
"use client";
import useSWR, { SWRConfiguration } from "swr";
import { appStore } from "@/app/store";
import { fetcher } from "lib/utils";
export function useWorkflowToolList(options?: SWRConfiguration) {
return useSWR("/api/workflow/tools", fetcher, {
errorRetryCount: 0,
revalidateOnFocus: false,
focusThrottleInterval: 1000 * 60 * 30,
fallbackData: [],
onSuccess: (data) => {
appStore.setState({ workflowToolList: data });
},
...options,
});
}