Fallback recommended users to demo profiles
cgen-b1f6a1e64f7e41299a73278fa1530c51
This commit is contained in:
parent
9adbe5e6f6
commit
72a90ef347
1 changed files with 13 additions and 10 deletions
|
|
@ -2,16 +2,19 @@ import { supabase } from "./supabase";
|
|||
|
||||
export const aethexSocialService = {
|
||||
async listRecommended(userId: string, limit = 10) {
|
||||
const { data, error } = await supabase
|
||||
.from("user_profiles")
|
||||
.select("id, username, full_name, avatar_url, bio")
|
||||
.neq("id", userId)
|
||||
.limit(limit);
|
||||
if (error) {
|
||||
console.warn("listRecommended error:", error);
|
||||
return [] as any[];
|
||||
}
|
||||
return data as any[];
|
||||
try {
|
||||
const { data, error } = await supabase
|
||||
.from("user_profiles")
|
||||
.select("id, username, full_name, avatar_url, bio")
|
||||
.neq("id", userId)
|
||||
.limit(limit);
|
||||
if (!error && data) return data as any[];
|
||||
} catch {}
|
||||
try {
|
||||
const raw = localStorage.getItem("demo_profiles");
|
||||
const profiles = raw ? JSON.parse(raw) : [];
|
||||
return profiles.filter((p:any)=>p.id!==userId).slice(0, limit);
|
||||
} catch { return [] as any[]; }
|
||||
},
|
||||
|
||||
async getFollowing(userId: string): Promise<string[]> {
|
||||
|
|
|
|||
Loading…
Reference in a new issue