每五分钟获取用户信息
This commit is contained in:
parent
4c06fdc2f5
commit
8f9a2743b1
16
package-lock.json
generated
16
package-lock.json
generated
@ -24,6 +24,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/event-source-polyfill": "^1.0.5",
|
||||
"@types/node": "^22.10.2",
|
||||
"@types/react": "^18.2.56",
|
||||
"@types/react-dom": "^18.2.19",
|
||||
"@typescript-eslint/eslint-plugin": "^7.0.2",
|
||||
@ -1505,6 +1506,15 @@
|
||||
"integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "22.10.2",
|
||||
"resolved": "https://registry.npmmirror.com/@types/node/-/node-22.10.2.tgz",
|
||||
"integrity": "sha512-Xxr6BBRCAOQixvonOye19wnzyDiUtTeqldOOmj3CkeblonbccA12PFwlufvRdrpjXxqnmUaeiU5EOA+7s5diUQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"undici-types": "~6.20.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/prop-types": {
|
||||
"version": "15.7.11",
|
||||
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.11.tgz",
|
||||
@ -4377,6 +4387,12 @@
|
||||
"node": ">=14.17"
|
||||
}
|
||||
},
|
||||
"node_modules/undici-types": {
|
||||
"version": "6.20.0",
|
||||
"resolved": "https://registry.npmmirror.com/undici-types/-/undici-types-6.20.0.tgz",
|
||||
"integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/update-browserslist-db": {
|
||||
"version": "1.0.13",
|
||||
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz",
|
||||
|
@ -26,6 +26,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/event-source-polyfill": "^1.0.5",
|
||||
"@types/node": "^22.10.2",
|
||||
"@types/react": "^18.2.56",
|
||||
"@types/react-dom": "^18.2.19",
|
||||
"@typescript-eslint/eslint-plugin": "^7.0.2",
|
||||
|
@ -1,11 +1,12 @@
|
||||
import './head.css'
|
||||
// import { NodeJS } from 'types/node';
|
||||
import { useDispatch } from 'react-redux'
|
||||
import BalanceHead from '../../components/balance/BalanceHead.tsx';
|
||||
import RechargeHead from '../../components/recharge/RechargeHead.tsx';
|
||||
import { Dropdown, MenuProps, message, Modal, Space, Spin, Input } from "antd";
|
||||
import { DownOutlined, UserOutlined, QuestionCircleOutlined, BellOutlined, KeyOutlined, LogoutOutlined, GiftOutlined, AccountBookOutlined, ContainerOutlined, MenuFoldOutlined, UsergroupAddOutlined } from "@ant-design/icons";
|
||||
import { useContext, useEffect, useState } from "react";
|
||||
import { put, get, post,getUseUrl } from "../../util/AjaxUtils.ts";
|
||||
import { put, get, post, getUseUrl } from "../../util/AjaxUtils.ts";
|
||||
import { GlobalContext, GlobalDispatchContext, reloadUser } from "../../context/GlobalContext.ts";
|
||||
import UserEdit from "../../components/user/UserEdit.tsx";
|
||||
import PasswordChange from "../../components/password/PasswordChange.tsx";
|
||||
@ -291,6 +292,9 @@ export default function Head() {
|
||||
// })
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
// getLength()
|
||||
reloadUser(messageApi, globalDispatchContext).then((data) => {
|
||||
@ -299,9 +303,16 @@ export default function Head() {
|
||||
}
|
||||
});
|
||||
}, [globalContext.user]);
|
||||
// 刷新用户信息
|
||||
const reloadUserInterval = async () => {
|
||||
await reloadUser(messageApi, globalDispatchContext);
|
||||
};
|
||||
useEffect(() => {
|
||||
getUnRead()
|
||||
setInterval(reloadUserInterval, 5 * 60 * 1000);
|
||||
}, [])
|
||||
|
||||
|
||||
const items: MenuProps['items'] = [
|
||||
{
|
||||
key: 'userinfo',
|
||||
|
@ -21,5 +21,6 @@
|
||||
"noFallthroughCasesInSwitch": true
|
||||
},
|
||||
"include": ["src"],
|
||||
"references": [{ "path": "./tsconfig.node.json" }]
|
||||
"references": [{ "path": "./tsconfig.node.json" }],
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user