Browse Source

单点登录的注释

release_0.0.3
巴林闲侠 2 years ago
parent
commit
a75526b023
  1. 7
      code/web/client/src/sections/auth/containers/cross.jsx

7
code/web/client/src/sections/auth/containers/cross.jsx

@ -16,16 +16,18 @@ const Cross = ({ dispatch, actions }) => {
const { data } = e
if (data && data.action) {
if (data.action == 'logout') {
// 退
preLogout()
} else if (data.action = 'login') {
//
localStorage.setItem('fs_iot_cross_user', JSON.stringify(data.user))
}
}
}
function storageListen (e) {
console.log(e);
if (e.key == 'fs_iot_cross_user') {
if (!e.newValue) {
// 退 退
// IOT AUTH 退
window.parent.postMessage({ action: 'logout' }, '*');
}
@ -40,12 +42,15 @@ const Cross = ({ dispatch, actions }) => {
user = JSON.parse(user)
const crossRslt = await dispatch(authAction.crossCheck({ token: user.token }))
if (crossRslt.success && crossRslt.payload.data.cross) {
//
window.parent.postMessage({ action: 'initUser', user: user }, '*');
} else {
// 退
window.parent.postMessage({ action: 'logout' }, '*');
preLogout()
}
} else {
//
window.parent.postMessage({ action: 'initNotice' }, '*');
}
}

Loading…
Cancel
Save