Skip to content

Commit

Permalink
fix: fixed multiple connection issue
Browse files Browse the repository at this point in the history
  • Loading branch information
shayan-deriv committed Jun 13, 2024
1 parent 9576e58 commit d8e6c18
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions public/localstorage-sync.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@
switch (message.data.key) {
case 'active_loginid': {
if (localStorage.getItem(message.data.key) !== message.data.value) {
console.log('setting p2p localStorage for active_loginid');
localStorage.setItem(message.data.key, message.data.value);
}
break;
}
case 'client.accounts': {
if (localStorage.getItem(message.data.key) !== message.data.value) {
console.log('setting p2p localStorage for client.accounts');
localStorage.setItem(message.data.key, message.data.value);
}
break;
Expand Down
6 changes: 4 additions & 2 deletions src/components/DerivIframe/DerivIframe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import { URLConstants } from '@deriv-com/utils';

const DerivIframe = () => {
const getAllowedLocalStorageOrigin = () => {
if (/^staging-p2p\.deriv\.com$/i.test(window.location.hostname)) {
const hostName = window.location.hostname;
if (/^staging-p2p\.deriv\.com$/i.test(hostName)) {
return URLConstants.derivP2pStaging;
} else if (/^localhost$/i.test(hostName)) {
return window.location.origin;
}

return URLConstants.derivP2pProduction;
};

Expand Down

0 comments on commit d8e6c18

Please sign in to comment.