Fallback listProfiles when table missing
cgen-f0da836d6f87442da49bcb67d2bb86f4
This commit is contained in:
parent
04667c4a8f
commit
eec76c50d5
1 changed files with 16 additions and 3 deletions
|
|
@ -213,9 +213,22 @@ export const aethexUserService = {
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
if (isTableMissing(error)) {
|
if (isTableMissing(error)) {
|
||||||
throw new Error(
|
console.warn('user_profiles table missing during listProfiles - returning local demo profiles');
|
||||||
'Supabase table "user_profiles" is missing. Please run the required migrations.',
|
try {
|
||||||
);
|
const keys = Object.keys(localStorage || {}).filter((k) => k.startsWith('demo_profile_'));
|
||||||
|
const profiles = keys
|
||||||
|
.map((k) => {
|
||||||
|
try {
|
||||||
|
return JSON.parse(localStorage.getItem(k) || "null");
|
||||||
|
} catch {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.filter(Boolean) as AethexUserProfile[];
|
||||||
|
return profiles.slice(0, limit);
|
||||||
|
} catch {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue