feat: add svelte-sonner dependency and enhance NotificationBell component
- Added `svelte-sonner` to dependencies for improved notification handling. - Refactored the `NotificationBell.svelte` component for better readability and maintainability, including code formatting and structure improvements. - Updated `package.json` and `bun.lock` to reflect the new dependency.
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
import { browser } from "$app/environment";
|
||||
import { goto } from "$app/navigation";
|
||||
import type { Id } from "@sgse-app/backend/convex/betterAuth/_generated/dataModel";
|
||||
|
||||
interface Usuario {
|
||||
_id: string;
|
||||
matricula: string;
|
||||
nome: string;
|
||||
email: string;
|
||||
funcionarioId?: string;
|
||||
funcionarioId?: Id<"funcionarios">;
|
||||
role: {
|
||||
_id: string;
|
||||
nome: string;
|
||||
@@ -100,19 +101,25 @@ class AuthStore {
|
||||
// Importação dinâmica do convex para evitar problemas de SSR
|
||||
const { ConvexHttpClient } = await import("convex/browser");
|
||||
const { api } = await import("@sgse-app/backend/convex/_generated/api");
|
||||
|
||||
|
||||
const client = new ConvexHttpClient(import.meta.env.VITE_CONVEX_URL);
|
||||
client.setAuth(this.state.token);
|
||||
|
||||
const usuarioAtualizado = await client.query(api.usuarios.obterPerfil, {});
|
||||
|
||||
|
||||
const usuarioAtualizado = await client.query(
|
||||
api.usuarios.obterPerfil,
|
||||
{}
|
||||
);
|
||||
|
||||
if (usuarioAtualizado && this.state.usuario) {
|
||||
this.state.usuario = {
|
||||
...this.state.usuario,
|
||||
...usuarioAtualizado,
|
||||
};
|
||||
|
||||
localStorage.setItem("auth_usuario", JSON.stringify(this.state.usuario));
|
||||
|
||||
localStorage.setItem(
|
||||
"auth_usuario",
|
||||
JSON.stringify(this.state.usuario)
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Erro ao atualizar perfil:", error);
|
||||
@@ -139,4 +146,3 @@ class AuthStore {
|
||||
}
|
||||
|
||||
export const authStore = new AuthStore();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user