UNPKG

@tycoonsystems/tycoon-modules

Version:
1 lines 594 B
import{fetchPost}from"@tycoonsystems/tycoon-modules/utility/fetch";import{resolveVariables}from"/app.config";export default async function handler(s){if(s){var t=((e,r)=>{if(0<e.length)for(let t=0;t<e.length;t++)Object.prototype.hasOwnProperty.call(s,e[t])&&(r[e[t]]=s[e[t]]);return r})(["toUserId","toUsername","toEmail","subject","content"],{}),t=await fetchPost(resolveVariables()?.apiUrl+"/m/sendemail",null,null,t);if(t&&t.hasOwnProperty("status")){if("disauthenticated"==t.status)return logout(),"disauthenticated";if("failed"==t.status)return!1;if("success"==t.status)return t}}return!1}