export const saveForm = (formId, nextFormId ,contractTypeId, contractUUID, answers, isLastQuestionMutation) => async dispatch => {
const funcName = saveForm.name;
const dataToPost = {
form_id: formId,
next_form_id: nextFormId,
contract_type_id: contractTypeId || null,
answers: answers
};
contractUUID && (dataToPost.contract_uuid = contractUUID);
isLastQuestionMutation && (dataToPost.is_last_question = isLastQuestionMutation);
try {
await dispatch(await pendingAction(true, funcName));
const response = await Axios.post(`${config.apiEndpoint}/save_answer`, dataToPost);
dispatch(pendingAction(false, funcName));
return response;
} catch(e) {
dispatch(pendingAction(false, funcName));
console.error(e.response);
throw(e);
}
};