Browse Source

定点登录判断

release_0.0.3
巴林闲侠 2 years ago
parent
commit
a0c22af8ed
  1. 1
      code/web/client/src/sections/auth/actions/auth.js
  2. 13
      code/web/client/src/sections/auth/containers/cross.jsx

1
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: {},

13
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()

Loading…
Cancel
Save