style: refactor fetch and context (#10795)

This commit is contained in:
AkaraChen
2024-11-19 17:16:06 +08:00
committed by GitHub
parent 328965ed7c
commit 1cc7dc6360
7 changed files with 131 additions and 14 deletions

13
web/service/use-base.ts Normal file
View File

@@ -0,0 +1,13 @@
import {
useQueryClient,
} from '@tanstack/react-query'
export const useInvalid = (key: string[]) => {
const queryClient = useQueryClient()
return () => {
queryClient.invalidateQueries(
{
queryKey: key,
})
}
}