rest API added
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import { onMount } from 'svelte';
|
||||
import { push } from 'svelte-spa-router';
|
||||
import { auth } from '../lib/stores/auth.js';
|
||||
import { supabase } from '../lib/supabase.js';
|
||||
import { getProfile, updateProfile, uploadAvatar } from '../lib/api/profile.js';
|
||||
|
||||
let profile = null;
|
||||
@@ -29,7 +30,7 @@
|
||||
loading = true;
|
||||
error = null;
|
||||
try {
|
||||
profile = await getProfile(userId);
|
||||
profile = await getProfile(supabase, userId);
|
||||
displayName = profile?.display_name ?? '';
|
||||
avatarPreview = profile?.avatar_url ?? null;
|
||||
} catch (e) {
|
||||
@@ -73,11 +74,11 @@
|
||||
} else if (avatarPreview === null && profile?.avatar_url) {
|
||||
avatarUrl = null;
|
||||
}
|
||||
await updateProfile(userId, {
|
||||
await updateProfile(supabase, userId, {
|
||||
display_name: displayName.trim() || null,
|
||||
avatar_url: avatarUrl,
|
||||
});
|
||||
profile = await getProfile(userId);
|
||||
profile = await getProfile(supabase, userId);
|
||||
displayName = profile?.display_name ?? '';
|
||||
avatarPreview = profile?.avatar_url ?? null;
|
||||
avatarFile = null;
|
||||
|
||||
Reference in New Issue
Block a user