import { useMutation } from 'react-query';

import { createSession } from '../services';

import { useNewSessionStepper } from './useNewSessionStepper';

export const useCreateSessionDraft = () => {
  const { setStep } = useNewSessionStepper();

  return useMutation({
    mutationFn: createSession,
    onSuccess: () => setStep('configuration'),
  });
};
