style: refactor fetch and context (#10795)
This commit is contained in:
parent
328965ed7c
commit
1cc7dc6360
7 changed files with 131 additions and 14 deletions
13
web/service/use-base.ts
Normal file
13
web/service/use-base.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import {
|
||||
useQueryClient,
|
||||
} from '@tanstack/react-query'
|
||||
|
||||
export const useInvalid = (key: string[]) => {
|
||||
const queryClient = useQueryClient()
|
||||
return () => {
|
||||
queryClient.invalidateQueries(
|
||||
{
|
||||
queryKey: key,
|
||||
})
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue