diff --git a/src/methods/send-email-code.js b/src/methods/send-email-code.js new file mode 100644 index 0000000..19ca0aa --- /dev/null +++ b/src/methods/send-email-code.js @@ -0,0 +1,26 @@ +import { passport } from '@ecomplus/client' + +/** + * @method + * @name EcomPassport#sendEmailCode + * @description Send verification code by email before login/signup. + * + * @param {string} email - Customer main email address + * + * @returns {Promise} + * + * @example + +ecomPassport.sendEmailCode('example@mail.com') + .catch(console.error) + + */ + +export default ({ storeId, lang }, emitter, [email]) => passport({ + url: `/${lang}/email-code`, + storeId, + method: 'PUT', + data: { + email + } +})