mirror of
https://github.com/expo/appjs24-workflows-workshop-code.git
synced 2026-11-15 17:29:20 -10:00
18 lines
483 B
TypeScript
18 lines
483 B
TypeScript
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
import { uniq } from "lodash";
|
|
|
|
const data = require("../api/cma_artwork.json");
|
|
|
|
export const useWorksForDepartmentQuery = function(department: string) {
|
|
const queryClient = useQueryClient();
|
|
|
|
// Queries
|
|
const query = useQuery({
|
|
queryKey: [`departments:${department}`],
|
|
queryFn: async () => {
|
|
return data.data.filter((item: any) => item.department === department);
|
|
},
|
|
});
|
|
|
|
return query;
|
|
} |