mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-07 18:23:28 +00:00
fix(networking.tsx): use more efficient query for getting list of users
This commit is contained in:
@@ -2514,10 +2514,10 @@ export const allTagNamesCall = async (accessToken: String) => {
|
||||
export const allEndUsersCall = async (accessToken: String) => {
|
||||
try {
|
||||
let url = proxyBaseUrl
|
||||
? `${proxyBaseUrl}/global/all_end_users`
|
||||
: `/global/all_end_users`;
|
||||
? `${proxyBaseUrl}/customer/list`
|
||||
: `/customer/list`;
|
||||
|
||||
console.log("in global/all_end_users call", url);
|
||||
console.log("in customer/list", url);
|
||||
const response = await fetch(`${url}`, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
|
||||
@@ -419,7 +419,8 @@ export default function SpendLogsTable({
|
||||
searchFn: async (searchText: string) => {
|
||||
if (!accessToken) return []
|
||||
const data = await allEndUsersCall(accessToken)
|
||||
const users = data?.end_users || []
|
||||
// data if set, is a list of objects, with key = user_id
|
||||
const users = data?.map((u: any) => u.user_id) || []
|
||||
const filtered = users.filter((u: string) => u.toLowerCase().includes(searchText.toLowerCase()))
|
||||
return filtered.map((u: string) => ({ label: u, value: u }))
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user