mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 11:14:04 +00:00
fix(view_users.tsx): cleanup use effect hooks
This commit is contained in:
parent
47023aa283
commit
124fa538ed
1 changed files with 5 additions and 2 deletions
|
@ -173,6 +173,7 @@ const ViewUserDashboard: React.FC<ViewUserDashboardProps> = ({
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
setUserListResponse(data);
|
setUserListResponse(data);
|
||||||
|
console.log("called from debouncedSearch");
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error searching users:", error);
|
console.error("Error searching users:", error);
|
||||||
|
@ -270,7 +271,7 @@ const ViewUserDashboard: React.FC<ViewUserDashboardProps> = ({
|
||||||
`userList_${currentPage}`,
|
`userList_${currentPage}`,
|
||||||
JSON.stringify(userDataResponse)
|
JSON.stringify(userDataResponse)
|
||||||
);
|
);
|
||||||
|
console.log("called from refreshUserData");
|
||||||
setUserListResponse(userDataResponse);
|
setUserListResponse(userDataResponse);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error refreshing user data:", error);
|
console.error("Error refreshing user data:", error);
|
||||||
|
@ -288,6 +289,7 @@ const ViewUserDashboard: React.FC<ViewUserDashboardProps> = ({
|
||||||
if (cachedUserData) {
|
if (cachedUserData) {
|
||||||
const parsedData = JSON.parse(cachedUserData);
|
const parsedData = JSON.parse(cachedUserData);
|
||||||
setUserListResponse(parsedData);
|
setUserListResponse(parsedData);
|
||||||
|
console.log("called from useEffect");
|
||||||
} else {
|
} else {
|
||||||
// Fetch from API using userListCall with current filters
|
// Fetch from API using userListCall with current filters
|
||||||
const userDataResponse = await userListCall(
|
const userDataResponse = await userListCall(
|
||||||
|
@ -307,6 +309,7 @@ const ViewUserDashboard: React.FC<ViewUserDashboardProps> = ({
|
||||||
);
|
);
|
||||||
|
|
||||||
setUserListResponse(userDataResponse);
|
setUserListResponse(userDataResponse);
|
||||||
|
console.log("called from useEffect 2");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch roles if not cached
|
// Fetch roles if not cached
|
||||||
|
@ -327,7 +330,7 @@ const ViewUserDashboard: React.FC<ViewUserDashboardProps> = ({
|
||||||
fetchData();
|
fetchData();
|
||||||
}
|
}
|
||||||
|
|
||||||
}, [accessToken, token, userRole, userID, currentPage, filters]);
|
}, [accessToken, token, userRole, userID]);
|
||||||
|
|
||||||
if (!userListResponse) {
|
if (!userListResponse) {
|
||||||
return <div>Loading...</div>;
|
return <div>Loading...</div>;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue