< script >
import axios from "axios";
import Bee from "@mailupinc/bee-plugin";
export default {
name: "App",
data() {
return {
info: null,
};
},
mounted() {
const beeInstance = new Bee();
var bee;
var endpoint = "https://auth.getbee.io/apiauth";
var payload = {
client_id: "4b59.....efff5",
client_secret: ".....fxvgF", // Enter your secret key
grant_type: "Basic V.....", // Do not change
};
axios.post(endpoint, payload).then(function(data) {
var token = data;
// continue initialization here...
console.log("token: ", data);
// Define a simple BEE Plugin configuration...
var config = {
uid: token.userName,
container: "bee-plugin-container",
language: "en-US",
// eslint-disable-next-line
onSave: (jsonFile, htmlFile) => {
const params = {
layout_json: jsonFile,
layout_html: htmlFile,
campaign_id: 1,
};
console.log("saving...", params);
},
};
var template = {
page: {
........
.......
beeInstance
.getToken(payload.client_id, payload.client_secret)
.then(() => beeInstance.start(config, template));
});
},
}; <
/script>
<template>
<div id="app">
<div id="bee-plugin-container"></div>
</div>
</template>
I am trying to integrate @mailupinc/bee-plugin in vuejs? by following the official document https://www.npmjs.com/package/@mailupinc/bee-plugin
Tried to initialize the editor in vuejs using axios, but i am not sure, weather it is right way of calling the axios call.(what i have done)
working codesandbox link:- https://codesandbox.io/s/bee-plugin-in-vuejs-forked-w923v?file=/src/App.vue
reference https://www.npmjs.com/package/@mailupinc/bee-plugin