refactor: integrate current user data across components
- Replaced instances of `authStore` with `currentUser` to streamline user authentication handling. - Updated permission checks and user-related data retrieval to utilize the new `useQuery` for better performance and clarity. - Cleaned up component structures and improved formatting for consistency and readability. - Enhanced error handling and user feedback mechanisms in various components to improve user experience.
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
import { goto } from "$app/navigation";
|
||||
import logo from "$lib/assets/logo_governo_PE.png";
|
||||
import type { Snippet } from "svelte";
|
||||
import { authStore } from "$lib/stores/auth.svelte";
|
||||
import { loginModalStore } from "$lib/stores/loginModal.svelte";
|
||||
import { useQuery } from "convex-svelte";
|
||||
import { api } from "@sgse-app/backend/convex/_generated/api";
|
||||
@@ -254,7 +253,7 @@
|
||||
{#if avatarUrlDoUsuario()}
|
||||
<img
|
||||
src={avatarUrlDoUsuario()}
|
||||
alt={authStore.usuario?.nome || "Usuário"}
|
||||
alt={currentUser.data?.nome || "Usuário"}
|
||||
class="w-full h-full object-cover relative z-10"
|
||||
/>
|
||||
{:else}
|
||||
@@ -277,8 +276,7 @@
|
||||
class="dropdown-content z-1 menu p-2 shadow-xl bg-base-100 rounded-box w-52 mt-4 border border-primary/20"
|
||||
>
|
||||
<li class="menu-title">
|
||||
<span class="text-primary font-bold">{authStore.usuario?.nome}</span
|
||||
>
|
||||
<span class="text-primary font-bold">{currentUser.data?.nome}</span>
|
||||
</li>
|
||||
<li><a href="/perfil">Meu Perfil</a></li>
|
||||
<li><a href="/alterar-senha">Alterar Senha</a></li>
|
||||
@@ -629,7 +627,7 @@
|
||||
{/if}
|
||||
|
||||
<!-- Componentes de Chat (apenas se autenticado) -->
|
||||
{#if authStore.autenticado}
|
||||
{#if currentUser.data}
|
||||
<PresenceManager />
|
||||
<ChatWidget />
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user