Don't forget to await!

This commit is contained in:
SachaG 2017-09-30 11:47:41 +09:00
parent ef2bed1902
commit 0fb9771376
2 changed files with 4 additions and 4 deletions

View file

@ -44,8 +44,8 @@ const LimitedString = ({ string }) =>
</div>
export const getFieldValue = (value, typeName) => {
if (typeof value === 'undefined') {
if (typeof value === 'undefined' || value === null) {
return ''
}

View file

@ -121,6 +121,7 @@ VulcanEmail.build = async ({ emailName, variables }) => {
const data = email.data ? {...result.data, ...email.data(variables)} : result.data;
const subject = typeof email.subject === 'function' ? email.subject(data) : email.subject;
const html = VulcanEmail.buildTemplate(VulcanEmail.getTemplate(email.template)(data));
return { data, subject, html };
@ -128,8 +129,7 @@ VulcanEmail.build = async ({ emailName, variables }) => {
VulcanEmail.buildAndSend = async ({ to, emailName, variables }) => {
const email = VulcanEmail.build({ to, emailName, variables });
const email = await VulcanEmail.build({ to, emailName, variables });
return VulcanEmail.send(to, email.subject, email.html);
};