fix: add validation for mailType in genMail function
This commit is contained in:
parent
c8763e9f55
commit
b4acbbaff9
1 changed files with 3 additions and 0 deletions
|
|
@ -69,6 +69,9 @@ export type NewMailProps = {
|
||||||
|
|
||||||
export const genMail = async ({ ...mail }: MailsTemplates) => {
|
export const genMail = async ({ ...mail }: MailsTemplates) => {
|
||||||
let mailComponent: JSX.Element | null = null;
|
let mailComponent: JSX.Element | null = null;
|
||||||
|
if (!Templates[mail.mailType]) {
|
||||||
|
return { html: "", title: "Email non valido/modello obsoleto" };
|
||||||
|
}
|
||||||
const title = Templates[mail.mailType].title;
|
const title = Templates[mail.mailType].title;
|
||||||
switch (mail.mailType) {
|
switch (mail.mailType) {
|
||||||
case "contattoAdminEmail":
|
case "contattoAdminEmail":
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue