UNPKG

minapp-fetch

Version:
28 lines (27 loc) 1.05 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const utils_1 = require("./utils/utils"); const constants_1 = require("./constants/constants"); const error_1 = require("./constants/error"); function fetchSendEmail(params = {}) { let { BaaS_F, minapp } = utils_1.getBaaSF(); return new Promise((resolve, reject) => { if (minapp === constants_1.PLATFORM_NAME.ZX_CLOUD) { BaaS_F.sendEmail(params).then((res) => { // 发送成功 resolve(res); }, (err) => { // 发送失败 reject(err); }); } if (constants_1.PLATFORM_ALL.indexOf(minapp) === -1) { throw new Error(`minapp.sendEmail ${error_1.METHOD_NOT_SUPPORT}`); } //MongoDB if (constants_1.PLATFORM_NAME_MONGO_SERVER.indexOf(minapp) > -1) { throw new Error(`minapp.sendEmail ${error_1.METHOD_NOT_SUPPORT}`); } }); } exports.default = fetchSendEmail;