Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ittweb/vsfapi-magento2-newsletter
This module enables Vue Storefront API to add the Magento 2 subscription to the newsletter.
https://github.com/ittweb/vsfapi-magento2-newsletter
Last synced: 3 months ago
JSON representation
This module enables Vue Storefront API to add the Magento 2 subscription to the newsletter.
- Host: GitHub
- URL: https://github.com/ittweb/vsfapi-magento2-newsletter
- Owner: ittweb
- License: mit
- Created: 2020-03-02T10:19:21.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-09-25T14:51:07.000Z (about 4 years ago)
- Last Synced: 2024-05-22T18:31:20.958Z (6 months ago)
- Language: JavaScript
- Size: 12.7 KB
- Stars: 4
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-vuestorefront - vsfapi-magento2-newsletter
README
# vsfapi-magento2-newsletter
This module enables Vue Storefront API to add the Magento 2 subscription to the newsletter.## Installation
To use it, please **install before the required Magento 2 module**:
https://github.com/ittweb/magento2-newsletter-apiAfter that you've **install the Ittweb_Newsletter M2 module**, then:
- download and paste the file of the src directory in the root of your Vue Storefront API project
- edit your `vue-storefront-api/config/local.json`, adding `magento2-subscribe` in the `registeredExtensions`
- edit your `vue-storefront/config/local.json` changing the newsletter endpoint to `/api/ext/magento2-subscribe/subscribe`Et voilà! Now your newsletter subscription will be associated with Magento 2.
## Google reCaptcha
It's strongly recommended to **enable the Google reCaptcha**.
To do so, edit your vue-storefront-api/config/local.json adding a new section like this one:
```
"googleRecaptcha": {
"enabled": true,
"secretKey": "your-secret-key"
},
```### IMPORTANT
If you **enable the Google reCaptcha you need to add** a new request body **parameter** named `token`.
The `token` parameter **MUST contain the grecaptcha.getResponse()** from the Google reCaptcha and is needed in addition to the `email` parameter to the POST and DELETE endpoint:`vue-storefront-api-url/api/ext/magento2-subscribe/`
You can find the functions that calls the API endpoint above on your `vue-storefront` installation, in the `core/data-resolver/NewsletterService.ts` file, functions `subscribe` and `unsubscribe`.