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,
});
client
.from<any>(userTable as any)
.select("*")
.limit(200)
.then(({ data, error }) => {
if (!error && Array.isArray(data)) setDevs(data.map(normalize));
else if (client !== supabase) {
supabase
.from<any>("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<any>(userTable as any)
.select("*")
.limit(200)
.then(({ data }) => setDevs((data || []).map(normalize)));
}
const studiosTable = client === devconnect ? "collectives" : "teams";
const mapStudio = (r: any): Studio => ({