fix sending true/false in html for email
This commit is contained in:
@@ -33,17 +33,20 @@ function send(app: PublicAPIApp) {
|
|||||||
app.openapi(route, async (c) => {
|
app.openapi(route, async (c) => {
|
||||||
const team = await getTeamFromToken(c);
|
const team = await getTeamFromToken(c);
|
||||||
|
|
||||||
|
let html = undefined;
|
||||||
|
|
||||||
|
const _html = c.req.valid("json")?.html?.toString();
|
||||||
|
|
||||||
|
if (_html && _html !== "true" && _html !== "false") {
|
||||||
|
html = _html;
|
||||||
|
}
|
||||||
|
|
||||||
const email = await sendEmail({
|
const email = await sendEmail({
|
||||||
...c.req.valid("json"),
|
...c.req.valid("json"),
|
||||||
teamId: team.id,
|
teamId: team.id,
|
||||||
apiKeyId: team.apiKeyId,
|
apiKeyId: team.apiKeyId,
|
||||||
text: c.req.valid("json").text ?? undefined,
|
text: c.req.valid("json").text ?? undefined,
|
||||||
html:
|
html: html,
|
||||||
!c.req.valid("json")?.html ||
|
|
||||||
c.req.valid("json")?.html === "false" ||
|
|
||||||
c.req.valid("json")?.html === "true"
|
|
||||||
? undefined
|
|
||||||
: c.req.valid("json").html?.toString(),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return c.json({ emailId: email?.id });
|
return c.json({ emailId: email?.id });
|
||||||
|
Reference in New Issue
Block a user