JSON.stringify

This commit is contained in:
Son NK
2022-11-08 17:13:58 +01:00
parent ea3c39f2df
commit 56f7ee629e
2 changed files with 22 additions and 13 deletions
+6 -3
View File
@@ -170,9 +170,12 @@ export default {
try {
console.log("send log out event to host app");
let r = await browser.runtime.sendNativeMessage("application.id", {
logged_out: {},
});
let r = await browser.runtime.sendNativeMessage(
"application.id",
JSON.stringify({
logged_out: {},
})
);
} catch (error) {
console.info("can't send data to native app", error);
}
+16 -10
View File
@@ -265,14 +265,17 @@ export default {
if (this.apiKey) {
try {
console.log("send api key to host app");
let r = await browser.runtime.sendNativeMessage("application.id", {
logged_in: {
data: {
api_key: this.apiKey,
api_url: this.apiUrl,
let r = await browser.runtime.sendNativeMessage(
"application.id",
JSON.stringify({
logged_in: {
data: {
api_key: this.apiKey,
api_url: this.apiUrl,
},
},
},
});
})
);
} catch (error) {
console.info("can't send data to native app", error);
}
@@ -527,9 +530,12 @@ export default {
async upgrade() {
try {
console.log("send upgrade event to host app");
let r = await browser.runtime.sendNativeMessage("application.id", {
upgrade: {},
});
let r = await browser.runtime.sendNativeMessage(
"application.id",
JSON.stringify({
upgrade: {},
})
);
} catch (error) {
console.info("can't send data to native app", error);
let upgradeURL = this.apiUrl + "/dashboard/pricing";