Skip to content

Commit

Permalink
feat: add resolveRelations method in $storybridge
Browse files Browse the repository at this point in the history
  • Loading branch information
emanuelgsouza committed Aug 20, 2020
1 parent fc41a01 commit d8c56c4
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/templates/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,23 @@ const Client = {
Vue.prototype.$storybridge.proxy = window.storyblok
cb()
})
},
resolveRelations: function (relationsToResolve, cb) {
var options = options || {}
options.accessToken = '<%= options.accessToken %>'
<% if (options.customParent) { %>options.customParent = '<%= options.customParent %>'<% } %>

this.load(() => {
const sb = window.storyblok
sb.init(options)
sb.on('input', (data) => {
sb.addComments(data.story.content, data.story.id)

sb.resolveRelations(data.story, relationsToResolve, (event) => {
cb(data)
})
})
})
}
}
}
Expand Down

0 comments on commit d8c56c4

Please sign in to comment.