Directory: use server proxy for DevConnect reads
cgen-9a1b92e63440437d80fe8d4db76dba16
This commit is contained in:
parent
bd9a28f1b1
commit
0759aa4358
1 changed files with 12 additions and 14 deletions
|
|
@ -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 => ({
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue