website refactor
This commit is contained in:
23
apps/website/hooks/team/useLeaveTeam.ts
Normal file
23
apps/website/hooks/team/useLeaveTeam.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
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';
|
||||
|
||||
interface LeaveTeamParams {
|
||||
teamId: string;
|
||||
driverId: string;
|
||||
}
|
||||
|
||||
export function useLeaveTeam(options?: Omit<UseMutationOptions<void, ApiError, LeaveTeamParams>, 'mutationFn'>) {
|
||||
const teamService = useInject(TEAM_SERVICE_TOKEN);
|
||||
|
||||
return useMutation<void, ApiError, LeaveTeamParams>({
|
||||
mutationFn: async (params) => {
|
||||
// Note: Leave team functionality would need to be added to teamService
|
||||
// For now, we'll use a placeholder
|
||||
console.log('Leaving team:', params);
|
||||
alert('Successfully left team');
|
||||
},
|
||||
...options,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user