69 lines
1.7 KiB
JavaScript
69 lines
1.7 KiB
JavaScript
import { consoleLogger } from "../core/logger";
|
|
import { requestJson } from "../clients/endpointClient";
|
|
|
|
export const sendEmail = async (
|
|
templateId,
|
|
emailAddress,
|
|
personalisation,
|
|
reference
|
|
) => {
|
|
var mailData = {
|
|
"templateId": templateId,
|
|
"emailAddress": emailAddress,
|
|
"reference": reference,
|
|
"personalisation": personalisation
|
|
};
|
|
|
|
try {
|
|
return await requestJson({
|
|
method: "post",
|
|
url: "/api/email/notify",
|
|
data: mailData
|
|
});
|
|
} catch (error) {
|
|
consoleLogger(error);
|
|
throw error;
|
|
}
|
|
};
|
|
|
|
export const sendContactUsConfirmation = async (formValues, language) => {
|
|
const mailData = {
|
|
"contactEmail": formValues.contactEmail,
|
|
"contactSubject": formValues.contactSubject,
|
|
"contactbody": formValues.contactbody,
|
|
"typeOfContact": formValues.typeOfContact,
|
|
"language": language
|
|
};
|
|
|
|
try {
|
|
return await requestJson({
|
|
method: "post",
|
|
url: "/api/email/contactus-confirmation",
|
|
data: mailData
|
|
});
|
|
} catch (error) {
|
|
consoleLogger(error);
|
|
throw error;
|
|
}
|
|
};
|
|
|
|
export const sendContactUsPETNotification = async (formValues) => {
|
|
const mailData = {
|
|
"contactEmail": formValues.contactEmail,
|
|
"contactSubject": formValues.contactSubject,
|
|
"contactbody": formValues.contactbody,
|
|
"typeOfContact": formValues.typeOfContact
|
|
};
|
|
|
|
try {
|
|
return await requestJson({
|
|
method: "post",
|
|
url: "/api/email/contactus-pet-notification",
|
|
data: mailData
|
|
});
|
|
} catch (error) {
|
|
consoleLogger(error);
|
|
throw error;
|
|
}
|
|
};
|