diff --git a/src/pages/User/SearchPage/UserTable.js b/src/pages/User/SearchPage/UserTable.js index 6b42854..97e95f8 100644 --- a/src/pages/User/SearchPage/UserTable.js +++ b/src/pages/User/SearchPage/UserTable.js @@ -5,50 +5,55 @@ import {useEffect} from "react"; import {useNavigate} from "react-router-dom"; import { useTheme } from '@mui/material/styles'; import Checkbox from '@mui/material/Checkbox'; -import * as UrlUtils from "../../../utils/ApiPathConst"; import * as HttpUtils from '../../../utils/HttpUtils'; +import { GLD_USER_PATH, GET_USER_LOCK, GET_USER_UNLOCK } from "utils/ApiPathConst"; import { notifyLockSuccess, notifyUnlockSuccess , clickableLink} from 'utils/CommonFunction'; // ==============================|| EVENT TABLE ||============================== // -export default function UserTable({recordList,setChangeLocked}) { - const [rows, setRows] = React.useState(recordList); +export default function UserTable({searchCriteria}) { + const [_searchCriteria, set_searchCriteria] = React.useState(searchCriteria); + const [reloadTime, setReloadTime] = React.useState(new Date()); const theme = useTheme(); const navigate = useNavigate() useEffect(() => { - setRows(recordList); - }, [recordList]); + set_searchCriteria(searchCriteria); + }, [searchCriteria]); + + useEffect(() => { + searchCriteria.reloadTime = reloadTime; + set_searchCriteria(searchCriteria); + }, [reloadTime]); const handleLock = (params) => () => { - setChangeLocked(false) + // setChangeLocked(false) if (params.row.locked==true){ doUnlock(params.id) }else{ doLock(params.id) - setRows(recordList); } } const doLock = (id) => { HttpUtils.get({ - url: UrlUtils.GET_USER_LOCK+"/"+id, + url: GET_USER_LOCK+"/"+id, onSuccess: function(){ - setRows(recordList); - setChangeLocked(true) + //setChangeLocked(true) notifyLockSuccess() + setReloadTime(new Date()); } }); }; const doUnlock = (id) => { HttpUtils.get({ - url: UrlUtils.GET_USER_UNLOCK+"/"+id, + url: GET_USER_UNLOCK+"/"+id, onSuccess: function(){ - setRows(recordList); - setChangeLocked(true) + //setChangeLocked(true) notifyUnlockSuccess() + setReloadTime(new Date()); } }); }; @@ -128,11 +133,14 @@ export default function UserTable({recordList,setChangeLocked}) { return (