24 lines
785 B
TypeScript
24 lines
785 B
TypeScript
import { useMutation, UseMutationOptions } from '@tanstack/react-query';
|
|
import { ApiError } from '@/lib/api/base/ApiError';
|
|
|
|
interface JoinTeamParams {
|
|
teamId: string;
|
|
driverId: string;
|
|
requiresApproval?: boolean;
|
|
}
|
|
|
|
export function useJoinTeam(options?: Omit<UseMutationOptions<void, ApiError, JoinTeamParams>, 'mutationFn'>) {
|
|
return useMutation<void, ApiError, JoinTeamParams>({
|
|
mutationFn: async (params) => {
|
|
// Note: Team join functionality would need to be added to teamService
|
|
// For now, we'll use a placeholder
|
|
console.log('Joining team:', params);
|
|
if (params.requiresApproval) {
|
|
alert('Join request sent! Wait for team approval.');
|
|
} else {
|
|
alert('Successfully joined team!');
|
|
}
|
|
},
|
|
...options,
|
|
});
|
|
} |