Improve mock fallback when Supabase returns empty objects
cgen-1919042aa9764046a6dcdbd9282911c5
This commit is contained in:
parent
b36b529e70
commit
f53d1a7735
1 changed files with 5 additions and 5 deletions
|
|
@ -77,8 +77,8 @@ export const aethexUserService = {
|
|||
.eq("id", user.id)
|
||||
.single();
|
||||
|
||||
if (error) {
|
||||
console.warn("Error fetching user profile, falling back to mock:", error);
|
||||
if (error || !data || Object.keys(data || {}).length === 0) {
|
||||
if (error) console.warn("Error fetching user profile, falling back to mock:", error);
|
||||
const mock = await mockAuth.getUserProfile(user.id as any);
|
||||
if (mock) {
|
||||
return {
|
||||
|
|
@ -123,9 +123,9 @@ export const aethexUserService = {
|
|||
.select()
|
||||
.single();
|
||||
|
||||
if (error) {
|
||||
console.warn("Error updating profile, attempting mock fallback:", error);
|
||||
if (isTableMissing(error)) {
|
||||
if (error || !data || Object.keys(data || {}).length === 0) {
|
||||
console.warn("Updating profile fallback to mock (error or empty):", error?.message);
|
||||
if (!error || isTableMissing(error)) {
|
||||
const mock = await mockAuth.updateProfile(
|
||||
userId as any,
|
||||
updates as any,
|
||||
|
|
|
|||
Loading…
Reference in a new issue