Adds plugin for Contentful synchronization (#75)
Adds plugin for Contentful Will create product and product variants in Contentful, when created in Medusa Closes #47
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
class ContentfulSubscriber {
|
||||
constructor({ contentfulService, eventBusService }) {
|
||||
this.contentfulService_ = contentfulService
|
||||
this.eventBus_ = eventBusService
|
||||
|
||||
this.eventBus_.subscribe("product-variant.updated", async (data) => {
|
||||
await this.contentfulService_.updateProductVariantInContentful(data)
|
||||
})
|
||||
|
||||
this.eventBus_.subscribe("product.updated", async (data) => {
|
||||
await this.contentfulService_.updateProductInContentful(data)
|
||||
})
|
||||
|
||||
this.eventBus_.subscribe("product.created", async (data) => {
|
||||
await this.contentfulService_.createProductVariantInContentful(data)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export default ContentfulSubscriber
|
||||
Reference in New Issue
Block a user