Remove local fallback in createInitialProfile
cgen-a4aa9cf9f3fe404fb3436bdebb61bd7f
This commit is contained in:
parent
a53162600b
commit
a6b7c214c3
1 changed files with 4 additions and 19 deletions
|
|
@ -280,24 +280,9 @@ export const aethexUserService = {
|
|||
|
||||
if (error) {
|
||||
if (isTableMissing(error)) {
|
||||
// Fallback to local profile storage when DB is not migrated
|
||||
console.warn('user_profiles table missing during createInitialProfile - using local fallback');
|
||||
const fallback: AethexUserProfile = {
|
||||
id: userId,
|
||||
username: profileData.username || `user_${Date.now()}`,
|
||||
full_name: profileData.full_name || profileData.username || `user_${Date.now()}`,
|
||||
user_type: (profileData as any).user_type || "community_member",
|
||||
experience_level: (profileData as any).experience_level || "beginner",
|
||||
level: 1,
|
||||
total_xp: 0,
|
||||
loyalty_points: 0,
|
||||
created_at: new Date().toISOString(),
|
||||
updated_at: new Date().toISOString(),
|
||||
} as AethexUserProfile;
|
||||
try {
|
||||
localStorage.setItem(`demo_profile_${userId}`, JSON.stringify(fallback));
|
||||
} catch {}
|
||||
return fallback;
|
||||
throw new Error(
|
||||
'Supabase table "user_profiles" is missing. Please run the required migrations.',
|
||||
);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
|
|
@ -606,7 +591,7 @@ export const aethexAchievementService = {
|
|||
if (achievement) {
|
||||
aethexToast.aethex({
|
||||
title: "Achievement Unlocked! 🎉",
|
||||
description: `${achievement.icon || "<EFBFBD><EFBFBD>"} ${achievement.name} - ${achievement.description}`,
|
||||
description: `${achievement.icon || "🏅"} ${achievement.name} - ${achievement.description}`,
|
||||
duration: 8000,
|
||||
});
|
||||
await this.updateUserXPAndLevel(userId, achievement.xp_reward);
|
||||
|
|
|
|||
Loading…
Reference in a new issue