Revert getCurrentUser to live Supabase logic
cgen-b5f580c72afa465dabc6bac1b1f5e52e
This commit is contained in:
parent
d0dd9e6719
commit
ed200cfa40
1 changed files with 0 additions and 31 deletions
|
|
@ -225,37 +225,6 @@ function isTableMissing(err: any): boolean {
|
||||||
// User Profile Services
|
// User Profile Services
|
||||||
export const aethexUserService = {
|
export const aethexUserService = {
|
||||||
async getCurrentUser(): Promise<AethexUserProfile | null> {
|
async getCurrentUser(): Promise<AethexUserProfile | null> {
|
||||||
if (!isSupabaseConfigured) {
|
|
||||||
const { data } = await mockAuth.getUser();
|
|
||||||
const user = data.user;
|
|
||||||
if (!user) return null;
|
|
||||||
|
|
||||||
const profile = await mockAuth.getUserProfile(user.id);
|
|
||||||
if (!profile || Object.keys(profile || {}).length === 0) {
|
|
||||||
return await this.createInitialProfile(
|
|
||||||
user.id,
|
|
||||||
{
|
|
||||||
username: user.email?.split("@")[0] || "user",
|
|
||||||
full_name: user.email?.split("@")[0] || "user",
|
|
||||||
},
|
|
||||||
user.email,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const normalized = normalizeProfile(
|
|
||||||
{
|
|
||||||
...profile,
|
|
||||||
user_type: (profile as any)?.user_type ?? "game_developer",
|
|
||||||
experience_level: (profile as any)?.experience_level ?? "beginner",
|
|
||||||
total_xp: (profile as any)?.total_xp ?? 0,
|
|
||||||
level: (profile as any)?.level ?? 1,
|
|
||||||
},
|
|
||||||
user.email ?? (profile as any)?.email ?? null,
|
|
||||||
);
|
|
||||||
|
|
||||||
return await ensureDailyStreakForProfile(normalized);
|
|
||||||
}
|
|
||||||
|
|
||||||
ensureSupabase();
|
ensureSupabase();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue