Revert "add messages api"

This reverts commit e07353cd87.
This commit is contained in:
kandrusyak
2022-10-05 17:22:07 +03:00
parent e07353cd87
commit 1448d3e7da
2 changed files with 11 additions and 16 deletions

View File

@@ -5,12 +5,10 @@ import { HashRouter as Router } from 'react-router-dom'
import App from './App' import App from './App'
import {store} from './store/store'; import {store} from './store/store';
import { allowMessages } from './utils/messagesApi' import './utils/messagesApi'
globalThis.Buffer = Buffer globalThis.Buffer = Buffer
allowMessages();
window.store = store; window.store = store;
BigInt.prototype.toJSON = function() { BigInt.prototype.toJSON = function() {

View File

@@ -1,15 +1,12 @@
export const allowMessages = () => { const domains = [
const domains = [ "http://dev.kandrusyak.ru",
"http://dev.kandrusyak.ru", ]
] window.addEventListener("message", messageHandler, false);
window.addEventListener("message", messageHandler, false); function messageHandler(event) {
if (!domains.includes(event.origin))
function messageHandler(event) { return;
if (!domains.includes(event.origin)) const { action, key, value } = event.data
return; if (action === 'save'){
const {action, key, value} = event.data window.localStorage.setItem(key, JSON.stringify(value))
if (action === 'save') {
window.localStorage.setItem(key, JSON.stringify(value))
}
} }
} }