From 874aeeb2cc2fda3b49d1220d6f6ac0e025a1a431 Mon Sep 17 00:00:00 2001 From: Alex Cheung Date: Thu, 26 Sep 2024 14:30:52 +0800 Subject: [PATCH] fix grid loading --- src/components/FiDataGrid.js | 14 +++++++--- .../ForgotPassword/AuthCallback/index.js | 4 +-- .../ForgotUsername/AuthCallback/index.js | 2 +- src/pages/authentication/Verify.js | 26 ++++++++++++------- 4 files changed, 30 insertions(+), 16 deletions(-) diff --git a/src/components/FiDataGrid.js b/src/components/FiDataGrid.js index 13c259f..69b6d7a 100644 --- a/src/components/FiDataGrid.js +++ b/src/components/FiDataGrid.js @@ -51,9 +51,11 @@ export function FiDataGrid({ rows, columns, sx, autoHeight, const [rowCount, setRowCount] = useState(0); useEffect(() => { - setPage(0); - set_doLoad(doLoad); - setLoading(true) + if (doLoad !== undefined && Object.keys(doLoad).length>0 ){ + setPage(0); + set_doLoad(doLoad); + setLoading(true) + } }, [doLoad]); useEffect(() => { @@ -93,6 +95,7 @@ export function FiDataGrid({ rows, columns, sx, autoHeight, if (customPageSize) { setPageSize(customPageSize); } + console.log(_doLoad) if (_doLoad !== undefined && Object.keys(_doLoad).length==0 ){ setLoading(false) if (applyGridOnReady !== undefined){ @@ -125,7 +128,10 @@ export function FiDataGrid({ rows, columns, sx, autoHeight, // console.log(Object.keys(_doLoad.params).length > 0) // console.log(Object.keys(_doLoad.params).length > 0) - if (_doLoad?.url == null) return; + if (_doLoad?.url == null){ + setLoading(false) + return; + } if (_doLoad.params == undefined) return; if (_doLoad.params.searchCriteria !== undefined) return; if (_doLoad.params == null) _doLoad.params = {}; diff --git a/src/pages/authentication/ForgotPassword/AuthCallback/index.js b/src/pages/authentication/ForgotPassword/AuthCallback/index.js index 47c1c33..1b378e0 100644 --- a/src/pages/authentication/ForgotPassword/AuthCallback/index.js +++ b/src/pages/authentication/ForgotPassword/AuthCallback/index.js @@ -388,8 +388,8 @@ const Index = () => { - - + + diff --git a/src/pages/authentication/ForgotUsername/AuthCallback/index.js b/src/pages/authentication/ForgotUsername/AuthCallback/index.js index 545e82d..8faecab 100644 --- a/src/pages/authentication/ForgotUsername/AuthCallback/index.js +++ b/src/pages/authentication/ForgotUsername/AuthCallback/index.js @@ -441,7 +441,7 @@ const Index = () => { {/* */} - + diff --git a/src/pages/authentication/Verify.js b/src/pages/authentication/Verify.js index c332dd9..a9325a8 100644 --- a/src/pages/authentication/Verify.js +++ b/src/pages/authentication/Verify.js @@ -26,19 +26,27 @@ export default function Verify() { const params = useParams() const handleVerify = async () => { - console.log("handleVerify()"); - const response = await axios.get(GET_VERIFY_USER_ACCOUNT, { + // console.log("handleVerify()"); + await axios.get(GET_VERIFY_USER_ACCOUNT, { params: { email: decodeURIComponent(params.email), emailVerifyHash: decodeURIComponent(params.verifyCode) } - }) - if (response.status === 200 && response.data) { - setVerifyState(true) - } else { + }).then( + (response)=>{ + if (response.status === 200 && response.data) { + setVerifyState(true) + } else { + setVerifyState(false) + } + setIsLoading(false) + } + ).catch(error => { + console.log(error) setVerifyState(false) - } - setIsLoading(false) + setIsLoading(false) + }); + } useEffect(() => { @@ -80,7 +88,7 @@ export default function Verify() { {/* */} - +