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