diff --git a/src/main.js b/src/main.js index f07516d..8910f3a 100755 --- a/src/main.js +++ b/src/main.js @@ -10,13 +10,17 @@ let activeTab = "desktop"; async function render() { const user = pb.authStore.model; - const avatar = pb.authStore.model?avatar; if (!user) { renderLogin(); return; } + // Avatar resminin tam URL'ini oluşturuyoruz + const avatarUrl = user?.avatar + ? `https://pocketbase.iontalp.com/api/files/${user.collectionId}/${user.id}/${user.avatar}` + : null; + let currentBg = user.selected_bg || "https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe?q=80&w=1920"; @@ -25,7 +29,6 @@ async function render() { let currentPage; if (activeTab === "settings") { currentPage = await renderSettings(pb, currentBg, (newBg) => { - // Veritabanı güncellendiğinde yerel kullanıcı modelini tazeleyip render ediyoruz pb.authStore.model.selected_bg = newBg; render(); }); @@ -35,11 +38,13 @@ async function render() { app.innerHTML = `
+
-
+
+ +
${currentPage.html}
@@ -71,8 +93,8 @@ async function render() { activeTab = "settings"; render(); }); - document.getElementById("profileBtn").addEventListener("click", () => { - activeTab = "profile"; + document.getElementById("logoutBtn").addEventListener("click", () => { + pb.authStore.clear(); render(); }); }