feat: boards with statuses fetch
This commit is contained in:
@ -2,8 +2,8 @@
|
||||
|
||||
import { queryOptions } from "@tanstack/react-query";
|
||||
import { client as _heyApiClient } from "../client.gen";
|
||||
import { getProjects, type Options } from "../sdk.gen";
|
||||
import type { GetProjectsData } from "../types.gen";
|
||||
import { getBoards, getProjects, type Options } from "../sdk.gen";
|
||||
import type { GetBoardsData, GetProjectsData } from "../types.gen";
|
||||
|
||||
export type QueryKey<TOptions extends Options> = [
|
||||
Pick<TOptions, "baseURL" | "body" | "headers" | "path" | "query"> & {
|
||||
@ -61,3 +61,24 @@ export const getProjectsOptions = (options?: Options<GetProjectsData>) => {
|
||||
queryKey: getProjectsQueryKey(options),
|
||||
});
|
||||
};
|
||||
|
||||
export const getBoardsQueryKey = (options: Options<GetBoardsData>) =>
|
||||
createQueryKey("getBoards", options);
|
||||
|
||||
/**
|
||||
* Get Boards
|
||||
*/
|
||||
export const getBoardsOptions = (options: Options<GetBoardsData>) => {
|
||||
return queryOptions({
|
||||
queryFn: async ({ queryKey, signal }) => {
|
||||
const { data } = await getBoards({
|
||||
...options,
|
||||
...queryKey[0],
|
||||
signal,
|
||||
throwOnError: true,
|
||||
});
|
||||
return data;
|
||||
},
|
||||
queryKey: getBoardsQueryKey(options),
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user