enquiryAction.js
759 Bytes
import axios from "axios";
import { CLEAR_ERRORS, ENQUIRY_SUBMIT_FAIL, ENQUIRY_SUBMIT_REQUEST, ENQUIRY_SUBMIT_SUCCESS } from "../constants/enquiryConstants";
export const sendEnquiry = async ({ activityId, userId, date, vendorId }) => {
const data = {
data: {
experience: activityId,
endUser: userId,
vendor: vendorId,
date,
status: "pending"
}
};
const config = {
headers: {
"Content-Type": "application/json"
}
};
console.log("data", data);
const response = await axios.post(`${process.env.NEXT_PUBLIC_BACKEND_API_URL}/api/enquires`, data, config);
return response.data;
};
// Clear errors
export const clearErrors = () => async dispatch => {
dispatch({
type: CLEAR_ERRORS
});
};