@@ -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() {
|
||||||
|
|||||||
@@ -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) {
|
||||||
function messageHandler(event) {
|
|
||||||
if (!domains.includes(event.origin))
|
if (!domains.includes(event.origin))
|
||||||
return;
|
return;
|
||||||
const {action, key, value} = event.data
|
const { action, key, value } = event.data
|
||||||
if (action === 'save') {
|
if (action === 'save'){
|
||||||
window.localStorage.setItem(key, JSON.stringify(value))
|
window.localStorage.setItem(key, JSON.stringify(value))
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user