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,
|
||||
});
|
||||
|
||||
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 => ({
|
||||
|
|
|
|||
Loading…
Reference in a new issue