You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gcgj-dify-1.7.0/web/service/use-base.ts

27 lines
450 B
TypeScript

import {
type QueryKey,
useQueryClient,
} from '@tanstack/react-query'
export const useInvalid = (key: QueryKey) => {
const queryClient = useQueryClient()
return () => {
queryClient.invalidateQueries(
{
queryKey: key,
},
)
}
}
export const useReset = (key: QueryKey) => {
const queryClient = useQueryClient()
return () => {
queryClient.resetQueries(
{
queryKey: key,
},
)
}
}