add messages api
This commit is contained in:
@@ -5,10 +5,12 @@ 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 './utils/messagesApi'
|
import { allowMessages } from './utils/messagesApi'
|
||||||
|
|
||||||
globalThis.Buffer = Buffer
|
globalThis.Buffer = Buffer
|
||||||
|
|
||||||
|
allowMessages();
|
||||||
|
|
||||||
window.store = store;
|
window.store = store;
|
||||||
|
|
||||||
BigInt.prototype.toJSON = function() {
|
BigInt.prototype.toJSON = function() {
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
|
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;
|
||||||
@@ -10,3 +12,4 @@ function messageHandler(event) {
|
|||||||
window.localStorage.setItem(key, JSON.stringify(value))
|
window.localStorage.setItem(key, JSON.stringify(value))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user