Directory: use server proxy for DevConnect reads

cgen-9a1b92e63440437d80fe8d4db76dba16
This commit is contained in:
Builder.io 2025-10-19 03:50:14 +00:00
parent bd9a28f1b1
commit 0759aa4358

View file

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