|
@ -34,17 +34,14 @@ const Cross = ({ dispatch, actions }) => { |
|
|
if (window.parent) { |
|
|
if (window.parent) { |
|
|
window.addEventListener('message', messageListen); |
|
|
window.addEventListener('message', messageListen); |
|
|
window.addEventListener("storage", storageListen); |
|
|
window.addEventListener("storage", storageListen); |
|
|
const user = localStorage.getItem('fs_iot_cross_user') |
|
|
let user = localStorage.getItem('fs_iot_cross_user') |
|
|
|
|
|
|
|
|
if (user) { |
|
|
if (user) { |
|
|
|
|
|
user = JSON.parse(user) |
|
|
const crossRslt = await dispatch(authAction.crossCheck({ token: user.token })) |
|
|
const crossRslt = await dispatch(authAction.crossCheck({ token: user.token })) |
|
|
if (crossRslt.success) { |
|
|
window.parent.postMessage({ action: 'initUser', user: user }, '*'); |
|
|
if (crossRslt.payload.data.cross) { |
|
|
if (crossRslt.success && crossRslt.payload.data.cross) { |
|
|
window.parent.postMessage({ action: 'initUser', user: JSON.parse(user) }, '*'); |
|
|
window.parent.postMessage({ action: 'initUser', user: user }, '*'); |
|
|
} else { |
|
|
|
|
|
window.parent.postMessage({ action: 'logout' }, '*'); |
|
|
|
|
|
preLogout() |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
window.parent.postMessage({ action: 'logout' }, '*'); |
|
|
window.parent.postMessage({ action: 'logout' }, '*'); |
|
|
preLogout() |
|
|
preLogout() |
|
|