first commit
This commit is contained in:
12
services/hooks/department.hook.ts
Normal file
12
services/hooks/department.hook.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { getDepartments } from "../api/department.api";
|
||||
|
||||
export const useGetAllDepartments = () => {
|
||||
return useQuery({
|
||||
// قرار دادن پارامترها در queryKey باعث میشود با تغییر هر کدام، کش باطل و درخواست جدید ارسال شود
|
||||
queryKey: ['get-all-tickets'],
|
||||
queryFn: () => getDepartments(),
|
||||
retry: false,
|
||||
refetchOnWindowFocus: false,
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user