fix(networking.tsx): use more efficient query for getting list of users

This commit is contained in:
Krrish Dholakia
2025-10-04 12:07:21 -07:00
parent 509927eec9
commit c2eb4d7f4e
2 changed files with 5 additions and 4 deletions
@@ -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 }))
},