Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Revert "Rpuato/test check post messages" #416

Merged
merged 1 commit into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions src/components/Main/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,25 +92,20 @@ const Main = () => {
}
loginAndSetTokens(token_list)
.then(({ account_info = {} }) => {
console.log(account_info, '1st');
if (account_info?.loginid) {
console.log(account_info, '2nd');
dispatch(setLoginId(account_info?.loginid));
dispatch(updateIsLogged(true));
dispatch(updateActiveAccount(account_info));
applyToolboxPermissions();
syncWithDerivApp();
} else {
console.log(account_info, '3rd');
dispatch(updateIsLogged(false));
}
})
.catch(() => {
console.log('6th');
dispatch(updateIsLogged(false));
})
.finally(() => {
console.log('5th');
resolve();
dispatch(setAccountSwitcherLoader(false));
});
Expand Down
9 changes: 2 additions & 7 deletions src/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,10 @@ export const removeAllTokens = () => {
export const isDone = varName => varName in store;

export const syncWithDerivApp = () => {
console.log('syncWithDerivApp');
const iframe = document.getElementById('localstorage-sync');
const { origin } = getRelatedDeriveOrigin();
console.log({ origin, client_acc: JSON.stringify(getClientAccounts()), active_login_id: getActiveLoginId() });

const postMessages = () => {
console.log('postMessages');
iframe.contentWindow.postMessage(
{
key: CLIENT_ACCOUNT,
Expand All @@ -173,10 +170,8 @@ export const syncWithDerivApp = () => {
};
if (iframe) {
if (document.readyState === 'complete' || document.readyState === 'interactive') {
console.log(document.readyState);
setTimeout(() => {
postMessages();
}, 100);
postMessages();
return;
}
if (!hasReadystateListener) {
hasReadystateListener = true;
Expand Down
Loading