diff --git a/client/pages/Directory.tsx b/client/pages/Directory.tsx index 1aef5b22..488ae736 100644 --- a/client/pages/Directory.tsx +++ b/client/pages/Directory.tsx @@ -87,20 +87,18 @@ export default function Directory() { total_xp: u.total_xp || u.xp || null, }); - client - .from(userTable as any) - .select("*") - .limit(200) - .then(({ data, error }) => { - if (!error && Array.isArray(data)) setDevs(data.map(normalize)); - else if (client !== supabase) { - supabase - .from("user_profiles" as any) - .select("*") - .limit(200) - .then(({ data: d2 }) => setDevs((d2 || []).map(normalize))); - } - }); + if (client === devconnect) { + fetch(`/api/devconnect/rest/${userTable}?select=*&limit=200`) + .then((r) => r.json()) + .then((data) => Array.isArray(data) && setDevs(data.map(normalize))) + .catch(() => setDevs([])); + } else { + client + .from(userTable as any) + .select("*") + .limit(200) + .then(({ data }) => setDevs((data || []).map(normalize))); + } const studiosTable = client === devconnect ? "collectives" : "teams"; const mapStudio = (r: any): Studio => ({