smart-core-util
Version:
smartx javascript utils
32 lines (24 loc) • 675 B
JavaScript
import { getCookie } from 'tiny-cookie'
class iSecurity {
constructor() {
}
/**
* every 10 seconds check token
*
*/
static install401({ messageBox, handler, message }) {
message = message || "授权信息过期,请重新登录";
let monitor = setInterval(function () {
var token = getCookie("token");
// console.log('monitor 401', token);
if (!token) {
messageBox(message).then((action) => {
handler();
clearInterval(monitor)
})
}
}, 10000)
}
}
export default iSecurity;