chore: add invalid all built in tools

pull/12372/head
Joel 2 years ago
parent 5c98d80fdf
commit edbfe27eb1

@ -12,13 +12,24 @@ import {
const NAME_SPACE = 'tools' const NAME_SPACE = 'tools'
const useAllBuiltInToolsKey = [NAME_SPACE, 'builtIn']
export const useAllBuiltInTools = () => { export const useAllBuiltInTools = () => {
return useQuery<ToolWithProvider[]>({ return useQuery<ToolWithProvider[]>({
queryKey: [NAME_SPACE, 'builtIn'], queryKey: useAllBuiltInToolsKey,
queryFn: () => get<ToolWithProvider[]>('/workspaces/current/tools/builtin'), queryFn: () => get<ToolWithProvider[]>('/workspaces/current/tools/builtin'),
}) })
} }
export const useInvalidateAllBuiltInTools = () => {
const queryClient = useQueryClient()
return () => {
queryClient.invalidateQueries(
{
queryKey: useAllBuiltInToolsKey,
})
}
}
const useAllCustomToolsKey = [NAME_SPACE, 'customTools'] const useAllCustomToolsKey = [NAME_SPACE, 'customTools']
export const useAllCustomTools = () => { export const useAllCustomTools = () => {
return useQuery<ToolWithProvider[]>({ return useQuery<ToolWithProvider[]>({

Loading…
Cancel
Save