From a0c22af8ed65aef4618a9b03083e33861452672a Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Mon, 20 Jun 2022 11:26:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9A=E7=82=B9=E7=99=BB=E5=BD=95=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/web/client/src/sections/auth/actions/auth.js | 1 + .../client/src/sections/auth/containers/cross.jsx | 13 +++++-------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/code/web/client/src/sections/auth/actions/auth.js b/code/web/client/src/sections/auth/actions/auth.js index 6652a1e..ed4e384 100644 --- a/code/web/client/src/sections/auth/actions/auth.js +++ b/code/web/client/src/sections/auth/actions/auth.js @@ -77,6 +77,7 @@ export function crossCheck (data) { basicAction({ type: "post", dispatch: dispatch, + data: data, actionType: "CROSS_CHECK", url: `${ApiTable.crossCheck}`, msg: {}, diff --git a/code/web/client/src/sections/auth/containers/cross.jsx b/code/web/client/src/sections/auth/containers/cross.jsx index 1e19da9..cfb0780 100644 --- a/code/web/client/src/sections/auth/containers/cross.jsx +++ b/code/web/client/src/sections/auth/containers/cross.jsx @@ -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()