InstallationShell
# Mit npm
npm install @onmyterms/strapi-plugin
# Oder mit yarn
yarn add @onmyterms/strapi-pluginconfig/plugins.tsTypeScript
// config/plugins.ts
export default {
'onmyterms': {
enabled: true,
config: {
apiKey: process.env.ONMYTERMS_API_KEY,
apiUrl: 'https://api.onmyterms.io/v1',
defaultLocale: 'de',
},
},
};Content-Type SchemaJSON
// In Ihrem Content-Type Schema
{
"attributes": {
"newsletter_consent": {
"type": "customField",
"customField": "plugin::onmyterms.consent",
"options": {
"documentId": "doc_98f7e6d5c4",
"mode": "doi",
"required": true
}
}
}
}Strapi ControllerTypeScript
// In Ihrem Strapi Controller
const consent = await strapi
.plugin('onmyterms')
.service('consent')
.create({
documentId: 'doc_98f7e6d5c4',
email: ctx.request.body.email,
metadata: {
source: 'strapi-form',
contentType: 'newsletter',
},
});