From cf6cd6f0b138ce010485f1d472159af6e8693013 Mon Sep 17 00:00:00 2001 From: moonlitgrace Date: Thu, 12 Dec 2024 16:19:40 +0530 Subject: [PATCH] refactor: export encapsulated function from store export a function to create store object with methods and better logics --- frontend/src/lib/components/header.svelte | 11 ++++--- .../modals/auth/forms/profile_select.svelte | 6 ++-- .../lib/components/modals/auth/index.svelte | 8 +++-- frontend/src/lib/stores/auth.svelte.ts | 25 ++++++++++------ frontend/src/lib/stores/modals.svelte.ts | 29 ++++++++++--------- frontend/src/routes/+layout.svelte | 6 ++-- 6 files changed, 51 insertions(+), 34 deletions(-) diff --git a/frontend/src/lib/components/header.svelte b/frontend/src/lib/components/header.svelte index 968ef4d..5ae8a59 100644 --- a/frontend/src/lib/components/header.svelte +++ b/frontend/src/lib/components/header.svelte @@ -4,8 +4,11 @@ import QuibbleTextLogo from '$lib/components/icons/logos/quibble_text.svelte'; import NotificationIcon from '$lib/components/icons/notification.svelte'; import Avatar from '$lib/components/ui/avatar.svelte'; - import { open_modal } from '$lib/stores/modals.svelte'; - import { get_auth_state } from '$lib/stores/auth.svelte'; + import { createModalsStore } from '$lib/stores/modals.svelte'; + import { createAuthStore } from '$lib/stores/auth.svelte'; + + const modalsStore = createModalsStore(), + authStore = createAuthStore();
- {#if get_auth_state().is_authenticated} + {#if authStore.state.is_authenticated}