15 lines
726 B
TypeScript
15 lines
726 B
TypeScript
import { useMutation, UseMutationOptions } from '@tanstack/react-query';
|
|
import { useInject } from '@/lib/di/hooks/useInject';
|
|
import { TEAM_SERVICE_TOKEN } from '@/lib/di/tokens';
|
|
import { ApiError } from '@/lib/api/base/ApiError';
|
|
import type { CreateTeamInputDTO } from '@/lib/types/generated/CreateTeamInputDTO';
|
|
import type { CreateTeamOutputDTO } from '@/lib/types/generated/CreateTeamOutputDTO';
|
|
|
|
export function useCreateTeam(options?: UseMutationOptions<CreateTeamOutputDTO, ApiError, CreateTeamInputDTO>) {
|
|
const teamService = useInject(TEAM_SERVICE_TOKEN);
|
|
|
|
return useMutation<CreateTeamOutputDTO, ApiError, CreateTeamInputDTO>({
|
|
mutationFn: (input) => teamService.createTeam(input),
|
|
...options,
|
|
});
|
|
} |