style: refactor fetch and context (#10795)

This commit is contained in:
AkaraChen 2024-11-19 17:16:06 +08:00 • committed by GitHub
commit 1cc7dc6360
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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,
})
}
}