feat: board creation and actions dropdown
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import { type Options, getBoards, updateBoard, getDeals, updateDeal, getProjects, getStatuses, updateStatus } from '../sdk.gen';
|
||||
import { type Options, getBoards, createBoard, updateBoard, getDeals, updateDeal, getProjects, getStatuses, updateStatus } from '../sdk.gen';
|
||||
import { queryOptions, type UseMutationOptions } from '@tanstack/react-query';
|
||||
import type { GetBoardsData, UpdateBoardData, UpdateBoardError, UpdateBoardResponse2, GetDealsData, UpdateDealData, UpdateDealError, UpdateDealResponse2, GetProjectsData, GetStatusesData, UpdateStatusData, UpdateStatusError, UpdateStatusResponse2 } from '../types.gen';
|
||||
import type { GetBoardsData, CreateBoardData, CreateBoardError, CreateBoardResponse2, UpdateBoardData, UpdateBoardError, UpdateBoardResponse2, GetDealsData, UpdateDealData, UpdateDealError, UpdateDealResponse2, GetProjectsData, GetStatusesData, UpdateStatusData, UpdateStatusError, UpdateStatusResponse2 } from '../types.gen';
|
||||
import type { AxiosError } from 'axios';
|
||||
import { client as _heyApiClient } from '../client.gen';
|
||||
|
||||
@ -57,6 +57,43 @@ export const getBoardsOptions = (options: Options<GetBoardsData>) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const createBoardQueryKey = (options: Options<CreateBoardData>) => createQueryKey('createBoard', options);
|
||||
|
||||
/**
|
||||
* Create Board
|
||||
*/
|
||||
export const createBoardOptions = (options: Options<CreateBoardData>) => {
|
||||
return queryOptions({
|
||||
queryFn: async ({ queryKey, signal }) => {
|
||||
const { data } = await createBoard({
|
||||
...options,
|
||||
...queryKey[0],
|
||||
signal,
|
||||
throwOnError: true
|
||||
});
|
||||
return data;
|
||||
},
|
||||
queryKey: createBoardQueryKey(options)
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Create Board
|
||||
*/
|
||||
export const createBoardMutation = (options?: Partial<Options<CreateBoardData>>): UseMutationOptions<CreateBoardResponse2, AxiosError<CreateBoardError>, Options<CreateBoardData>> => {
|
||||
const mutationOptions: UseMutationOptions<CreateBoardResponse2, AxiosError<CreateBoardError>, Options<CreateBoardData>> = {
|
||||
mutationFn: async (localOptions) => {
|
||||
const { data } = await createBoard({
|
||||
...options,
|
||||
...localOptions,
|
||||
throwOnError: true
|
||||
});
|
||||
return data;
|
||||
}
|
||||
};
|
||||
return mutationOptions;
|
||||
};
|
||||
|
||||
/**
|
||||
* Update Board
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user