From a6cc0b83aad431c4e0692caf0010f50732aff249 Mon Sep 17 00:00:00 2001 From: Till-JS <101404291+Till-JS@users.noreply.github.com> Date: Sun, 7 Dec 2025 14:44:58 +0100 Subject: [PATCH] fix(manacore): auth flow and dashboard widget API fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Auth fixes: - Update fetchInterceptor skip patterns for ManaCore auth endpoints - Fix URL matching to compare full origins instead of partial matches - Update token manager state after successful login - Remove Supabase session dependency from layouts - Use authStore for auth state in route layouts Dashboard fixes: - Add network error detection in base-client to prevent infinite retries - Update all 9 dashboard widgets to not retry on service unavailable - Add /api/v1 prefix to all backend service URLs (chat, calendar, contacts, todo, zitare, picture, manadeck) Commands: - Add dev:manacore:backends to start all 9 dashboard backends - Add dev:manacore:full to start web + all backends together - Update COMMANDS.md with new commands and backend port table Auth service: - Fix TypeScript error: crossApp → cross_app in referrals schema 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- COMMANDS.md | 47 +- apps/manacore/apps/web/src/app.d.ts | 3 +- .../apps/web/src/lib/api/base-client.ts | 26 +- .../apps/web/src/lib/api/services/calendar.ts | 2 +- .../apps/web/src/lib/api/services/chat.ts | 2 +- .../apps/web/src/lib/api/services/contacts.ts | 2 +- .../apps/web/src/lib/api/services/manadeck.ts | 8 +- .../apps/web/src/lib/api/services/picture.ts | 8 +- .../apps/web/src/lib/api/services/todo.ts | 2 +- .../apps/web/src/lib/api/services/zitare.ts | 2 +- .../widgets/CalendarEventsWidget.svelte | 4 +- .../dashboard/widgets/ChatRecentWidget.svelte | 4 +- .../widgets/ClockTimersWidget.svelte | 4 +- .../widgets/ContactsFavoritesWidget.svelte | 8 +- .../widgets/ManadeckProgressWidget.svelte | 4 +- .../widgets/PictureRecentWidget.svelte | 4 +- .../dashboard/widgets/TasksTodayWidget.svelte | 5 +- .../widgets/TasksUpcomingWidget.svelte | 4 +- .../widgets/ZitareQuoteWidget.svelte | 8 +- .../apps/web/src/lib/stores/auth.svelte.ts | 9 + .../apps/web/src/routes/(app)/+layout.svelte | 27 +- .../apps/web/src/routes/(auth)/+layout.svelte | 7 +- apps/manacore/apps/web/src/routes/+layout.ts | 15 +- package.json | 2 + .../src/interceptors/fetchInterceptor.ts | 29 +- .../src/db/schema/referrals.schema.ts | 522 +++++++++++ .../mana-core-auth/src/referrals/dto/index.ts | 191 ++++ .../src/referrals/referrals.controller.ts | 264 ++++++ .../src/referrals/referrals.module.ts | 24 + .../src/referrals/services/index.ts | 3 + .../services/referral-code.service.ts | 376 ++++++++ .../services/referral-tier.service.ts | 254 ++++++ .../services/referral-tracking.service.ts | 832 ++++++++++++++++++ 33 files changed, 2634 insertions(+), 68 deletions(-) create mode 100644 services/mana-core-auth/src/db/schema/referrals.schema.ts create mode 100644 services/mana-core-auth/src/referrals/dto/index.ts create mode 100644 services/mana-core-auth/src/referrals/referrals.controller.ts create mode 100644 services/mana-core-auth/src/referrals/referrals.module.ts create mode 100644 services/mana-core-auth/src/referrals/services/index.ts create mode 100644 services/mana-core-auth/src/referrals/services/referral-code.service.ts create mode 100644 services/mana-core-auth/src/referrals/services/referral-tier.service.ts create mode 100644 services/mana-core-auth/src/referrals/services/referral-tracking.service.ts diff --git a/COMMANDS.md b/COMMANDS.md index 815e48ccd..dd4af00e9 100644 --- a/COMMANDS.md +++ b/COMMANDS.md @@ -10,10 +10,14 @@ pnpm dev:calendar:app pnpm dev:chat:app pnpm dev:clock:app pnpm dev:contacts:app -pnpm dev:inventory:app -pnpm dev:manacore:app +pnpm dev:context:app +pnpm dev:manacore:app # Nur ManaCore Web +pnpm dev:manacore:backends # Alle 9 Backends für Dashboard-Widgets +pnpm dev:manacore:full # Web + alle Backends (empfohlen) pnpm dev:manadeck:app pnpm dev:picture:app + +pnpm dev:inventory:app pnpm dev:presi:app pnpm dev:storage:app pnpm dev:techbase:app @@ -249,17 +253,44 @@ pnpm presi:db:seed # Seed-Daten ## Manacore -| App | Port | Befehl | -| ------- | ---- | --------------------------- | -| Web | - | `pnpm dev:manacore:web` | -| Mobile | 8081 | `pnpm dev:manacore:mobile` | -| Landing | - | `pnpm dev:manacore:landing` | +| App | Port | Befehl | +| -------- | ---- | ---------------------------- | +| Web | 5173 | `pnpm dev:manacore:web` | +| Mobile | 8081 | `pnpm dev:manacore:mobile` | +| Landing | - | `pnpm dev:manacore:landing` | +| Backends | - | `pnpm dev:manacore:backends` | ```bash -# Alles +# Nur ManaCore Web +pnpm dev:manacore:app + +# Alle Backends für Dashboard-Widgets starten (9 Services parallel) +# Startet: auth, chat, calendar, contacts, todo, zitare, picture, manadeck, clock +pnpm dev:manacore:backends + +# ManaCore Web + alle Backends zusammen (empfohlen für Dashboard-Entwicklung) +pnpm dev:manacore:full + +# Alles inkl. Mobile pnpm manacore:dev ``` +### Dashboard-Backends Übersicht + +Die Dashboard-Widgets benötigen diese Backend-Services: + +| Widget | Backend | Port | +| -------------------- | -------- | ---- | +| Credits | auth | 3001 | +| Chat Recent | chat | 3002 | +| Calendar Events | calendar | 3014 | +| Contacts Favorites | contacts | 3015 | +| Tasks Today/Upcoming | todo | 3017 | +| Zitare Quote | zitare | 3007 | +| Picture Recent | picture | 3006 | +| Manadeck Progress | manadeck | 3009 | +| Clock Timers | clock | 3018 | + --- ## Mana Games diff --git a/apps/manacore/apps/web/src/app.d.ts b/apps/manacore/apps/web/src/app.d.ts index 4f49fedc2..9272c6861 100644 --- a/apps/manacore/apps/web/src/app.d.ts +++ b/apps/manacore/apps/web/src/app.d.ts @@ -9,7 +9,8 @@ declare global { user: User | null; } interface PageData { - session: Session | null; + // Auth is handled by Mana Core Auth (@manacore/shared-auth), not Supabase + // Supabase is used for database operations only supabase?: SupabaseClient; } // interface Error {} diff --git a/apps/manacore/apps/web/src/lib/api/base-client.ts b/apps/manacore/apps/web/src/lib/api/base-client.ts index 6e4394049..ffa7b0076 100644 --- a/apps/manacore/apps/web/src/lib/api/base-client.ts +++ b/apps/manacore/apps/web/src/lib/api/base-client.ts @@ -39,6 +39,21 @@ function sleep(ms: number): Promise { return new Promise((resolve) => setTimeout(resolve, ms)); } +/** + * Check if error is a network/connection error that shouldn't be retried + */ +function isNetworkError(error: Error): boolean { + const message = error.message.toLowerCase(); + return ( + message.includes('failed to fetch') || + message.includes('network') || + message.includes('connection refused') || + message.includes('err_connection_refused') || + message.includes('econnrefused') || + message.includes('load failed') + ); +} + /** * Fetch with authentication and retry logic * @@ -93,7 +108,16 @@ export async function fetchWithRetry( const data = await response.json(); return { data, error: null }; } catch (e) { - lastError = e instanceof Error ? e.message : 'Unknown error'; + const error = e instanceof Error ? e : new Error('Unknown error'); + lastError = error.message; + + // Don't retry on network errors (service unavailable) + if (isNetworkError(error)) { + return { + data: null, + error: 'Service nicht erreichbar', + }; + } // Don't retry on last attempt if (attempt < config.maxRetries) { diff --git a/apps/manacore/apps/web/src/lib/api/services/calendar.ts b/apps/manacore/apps/web/src/lib/api/services/calendar.ts index 1c89bafc3..825bbf197 100644 --- a/apps/manacore/apps/web/src/lib/api/services/calendar.ts +++ b/apps/manacore/apps/web/src/lib/api/services/calendar.ts @@ -7,7 +7,7 @@ import { createApiClient, type ApiResult } from '../base-client'; // Backend URL - falls back to localhost for development -const CALENDAR_API_URL = import.meta.env.PUBLIC_CALENDAR_API_URL || 'http://localhost:3014'; +const CALENDAR_API_URL = import.meta.env.PUBLIC_CALENDAR_API_URL || 'http://localhost:3014/api/v1'; const client = createApiClient(CALENDAR_API_URL); diff --git a/apps/manacore/apps/web/src/lib/api/services/chat.ts b/apps/manacore/apps/web/src/lib/api/services/chat.ts index 51a201c46..c52f136d8 100644 --- a/apps/manacore/apps/web/src/lib/api/services/chat.ts +++ b/apps/manacore/apps/web/src/lib/api/services/chat.ts @@ -7,7 +7,7 @@ import { createApiClient, type ApiResult } from '../base-client'; // Backend URL - falls back to localhost for development -const CHAT_API_URL = import.meta.env.PUBLIC_CHAT_API_URL || 'http://localhost:3002'; +const CHAT_API_URL = import.meta.env.PUBLIC_CHAT_API_URL || 'http://localhost:3002/api/v1'; const client = createApiClient(CHAT_API_URL); diff --git a/apps/manacore/apps/web/src/lib/api/services/contacts.ts b/apps/manacore/apps/web/src/lib/api/services/contacts.ts index 1ad60be60..2491e8427 100644 --- a/apps/manacore/apps/web/src/lib/api/services/contacts.ts +++ b/apps/manacore/apps/web/src/lib/api/services/contacts.ts @@ -7,7 +7,7 @@ import { createApiClient, type ApiResult } from '../base-client'; // Backend URL - falls back to localhost for development -const CONTACTS_API_URL = import.meta.env.PUBLIC_CONTACTS_API_URL || 'http://localhost:3015'; +const CONTACTS_API_URL = import.meta.env.PUBLIC_CONTACTS_API_URL || 'http://localhost:3015/api/v1'; const client = createApiClient(CONTACTS_API_URL); diff --git a/apps/manacore/apps/web/src/lib/api/services/manadeck.ts b/apps/manacore/apps/web/src/lib/api/services/manadeck.ts index 8ed5fab23..5f8e5ea73 100644 --- a/apps/manacore/apps/web/src/lib/api/services/manadeck.ts +++ b/apps/manacore/apps/web/src/lib/api/services/manadeck.ts @@ -7,7 +7,7 @@ import { createApiClient, type ApiResult } from '../base-client'; // Backend URL - falls back to localhost for development -const MANADECK_API_URL = import.meta.env.PUBLIC_MANADECK_API_URL || 'http://localhost:3009'; +const MANADECK_API_URL = import.meta.env.PUBLIC_MANADECK_API_URL || 'http://localhost:3009/api/v1'; const client = createApiClient(MANADECK_API_URL); @@ -64,21 +64,21 @@ export const manadeckService = { * Get user's decks */ async getDecks(): Promise> { - return client.get('/api/decks'); + return client.get('/decks'); }, /** * Get learning progress */ async getLearningProgress(): Promise> { - return client.get('/api/progress'); + return client.get('/progress'); }, /** * Get cards due for review today */ async getDueCards(limit = 10): Promise> { - return client.get(`/api/cards/due?limit=${limit}`); + return client.get(`/cards/due?limit=${limit}`); }, /** diff --git a/apps/manacore/apps/web/src/lib/api/services/picture.ts b/apps/manacore/apps/web/src/lib/api/services/picture.ts index bfd903f88..6a099a090 100644 --- a/apps/manacore/apps/web/src/lib/api/services/picture.ts +++ b/apps/manacore/apps/web/src/lib/api/services/picture.ts @@ -7,7 +7,7 @@ import { createApiClient, type ApiResult } from '../base-client'; // Backend URL - falls back to localhost for development -const PICTURE_API_URL = import.meta.env.PUBLIC_PICTURE_API_URL || 'http://localhost:3006'; +const PICTURE_API_URL = import.meta.env.PUBLIC_PICTURE_API_URL || 'http://localhost:3006/api/v1'; const client = createApiClient(PICTURE_API_URL); @@ -49,21 +49,21 @@ export const pictureService = { * Get user's recent generations */ async getRecentGenerations(limit = 6): Promise> { - return client.get(`/api/generations?limit=${limit}&sort=createdAt:desc`); + return client.get(`/generations?limit=${limit}&sort=createdAt:desc`); }, /** * Get user's favorite images */ async getFavorites(limit = 6): Promise> { - return client.get(`/api/generations?favorite=true&limit=${limit}`); + return client.get(`/generations?favorite=true&limit=${limit}`); }, /** * Get generation statistics */ async getStats(): Promise> { - return client.get('/api/stats'); + return client.get('/stats'); }, /** diff --git a/apps/manacore/apps/web/src/lib/api/services/todo.ts b/apps/manacore/apps/web/src/lib/api/services/todo.ts index c3ee6936c..d5d6690f0 100644 --- a/apps/manacore/apps/web/src/lib/api/services/todo.ts +++ b/apps/manacore/apps/web/src/lib/api/services/todo.ts @@ -7,7 +7,7 @@ import { createApiClient, type ApiResult } from '../base-client'; // Backend URL - falls back to localhost for development -const TODO_API_URL = import.meta.env.PUBLIC_TODO_API_URL || 'http://localhost:3017'; +const TODO_API_URL = import.meta.env.PUBLIC_TODO_API_URL || 'http://localhost:3017/api/v1'; const client = createApiClient(TODO_API_URL); diff --git a/apps/manacore/apps/web/src/lib/api/services/zitare.ts b/apps/manacore/apps/web/src/lib/api/services/zitare.ts index 56bf27874..43ed47965 100644 --- a/apps/manacore/apps/web/src/lib/api/services/zitare.ts +++ b/apps/manacore/apps/web/src/lib/api/services/zitare.ts @@ -7,7 +7,7 @@ import { createApiClient, type ApiResult } from '../base-client'; // Backend URL - falls back to localhost for development -const ZITARE_API_URL = import.meta.env.PUBLIC_ZITARE_API_URL || 'http://localhost:3007'; +const ZITARE_API_URL = import.meta.env.PUBLIC_ZITARE_API_URL || 'http://localhost:3007/api/v1'; const client = createApiClient(ZITARE_API_URL); diff --git a/apps/manacore/apps/web/src/lib/components/dashboard/widgets/CalendarEventsWidget.svelte b/apps/manacore/apps/web/src/lib/components/dashboard/widgets/CalendarEventsWidget.svelte index b4ab205d1..66e2f6676 100644 --- a/apps/manacore/apps/web/src/lib/components/dashboard/widgets/CalendarEventsWidget.svelte +++ b/apps/manacore/apps/web/src/lib/components/dashboard/widgets/CalendarEventsWidget.svelte @@ -31,7 +31,9 @@ error = result.error; state = 'error'; - if (retryCount < 3) { + // Don't retry if service is unavailable (network error) + const isServiceUnavailable = error?.includes('nicht erreichbar'); + if (!isServiceUnavailable && retryCount < 3) { retryCount++; setTimeout(load, 5000 * retryCount); } diff --git a/apps/manacore/apps/web/src/lib/components/dashboard/widgets/ChatRecentWidget.svelte b/apps/manacore/apps/web/src/lib/components/dashboard/widgets/ChatRecentWidget.svelte index 8fbf50212..e486b802e 100644 --- a/apps/manacore/apps/web/src/lib/components/dashboard/widgets/ChatRecentWidget.svelte +++ b/apps/manacore/apps/web/src/lib/components/dashboard/widgets/ChatRecentWidget.svelte @@ -31,7 +31,9 @@ error = result.error; state = 'error'; - if (retryCount < 3) { + // Don't retry if service is unavailable (network error) + const isServiceUnavailable = error?.includes('nicht erreichbar'); + if (!isServiceUnavailable && retryCount < 3) { retryCount++; setTimeout(load, 5000 * retryCount); } diff --git a/apps/manacore/apps/web/src/lib/components/dashboard/widgets/ClockTimersWidget.svelte b/apps/manacore/apps/web/src/lib/components/dashboard/widgets/ClockTimersWidget.svelte index ee40d0fb6..560faac4e 100644 --- a/apps/manacore/apps/web/src/lib/components/dashboard/widgets/ClockTimersWidget.svelte +++ b/apps/manacore/apps/web/src/lib/components/dashboard/widgets/ClockTimersWidget.svelte @@ -37,7 +37,9 @@ error = timersResult.error || alarmsResult.error || statsResult.error; state = 'error'; - if (retryCount < 3) { + // Don't retry if service is unavailable (network error) + const isServiceUnavailable = error?.includes('nicht erreichbar'); + if (!isServiceUnavailable && retryCount < 3) { retryCount++; setTimeout(load, 5000 * retryCount); } diff --git a/apps/manacore/apps/web/src/lib/components/dashboard/widgets/ContactsFavoritesWidget.svelte b/apps/manacore/apps/web/src/lib/components/dashboard/widgets/ContactsFavoritesWidget.svelte index a70cbe526..999c82c98 100644 --- a/apps/manacore/apps/web/src/lib/components/dashboard/widgets/ContactsFavoritesWidget.svelte +++ b/apps/manacore/apps/web/src/lib/components/dashboard/widgets/ContactsFavoritesWidget.svelte @@ -36,7 +36,9 @@ error = result.error; state = 'error'; - if (retryCount < 3) { + // Don't retry if service is unavailable (network error) + const isServiceUnavailable = error?.includes('nicht erreichbar'); + if (!isServiceUnavailable && retryCount < 3) { retryCount++; setTimeout(load, 5000 * retryCount); } @@ -75,7 +77,7 @@ {:else if data.length === 0}
-
+
=�

{$_('dashboard.widgets.contacts.empty')}

@@ -127,7 +129,7 @@ rel="noopener" class="mt-3 block text-center text-sm text-primary hover:underline" > - {$_('dashboard.widgets.contacts.view_all')} ’ + {$_('dashboard.widgets.contacts.view_all')} � {/if}
diff --git a/apps/manacore/apps/web/src/lib/components/dashboard/widgets/ManadeckProgressWidget.svelte b/apps/manacore/apps/web/src/lib/components/dashboard/widgets/ManadeckProgressWidget.svelte index f36601c52..d2e65f7a0 100644 --- a/apps/manacore/apps/web/src/lib/components/dashboard/widgets/ManadeckProgressWidget.svelte +++ b/apps/manacore/apps/web/src/lib/components/dashboard/widgets/ManadeckProgressWidget.svelte @@ -34,7 +34,9 @@ error = progressResult.error || decksResult.error; state = 'error'; - if (retryCount < 3) { + // Don't retry if service is unavailable (network error) + const isServiceUnavailable = error?.includes('nicht erreichbar'); + if (!isServiceUnavailable && retryCount < 3) { retryCount++; setTimeout(load, 5000 * retryCount); } diff --git a/apps/manacore/apps/web/src/lib/components/dashboard/widgets/PictureRecentWidget.svelte b/apps/manacore/apps/web/src/lib/components/dashboard/widgets/PictureRecentWidget.svelte index d7b1fb7df..c7c8f5385 100644 --- a/apps/manacore/apps/web/src/lib/components/dashboard/widgets/PictureRecentWidget.svelte +++ b/apps/manacore/apps/web/src/lib/components/dashboard/widgets/PictureRecentWidget.svelte @@ -31,7 +31,9 @@ error = result.error; state = 'error'; - if (retryCount < 3) { + // Don't retry if service is unavailable (network error) + const isServiceUnavailable = error?.includes('nicht erreichbar'); + if (!isServiceUnavailable && retryCount < 3) { retryCount++; setTimeout(load, 5000 * retryCount); } diff --git a/apps/manacore/apps/web/src/lib/components/dashboard/widgets/TasksTodayWidget.svelte b/apps/manacore/apps/web/src/lib/components/dashboard/widgets/TasksTodayWidget.svelte index 17d7949b2..8bc531a80 100644 --- a/apps/manacore/apps/web/src/lib/components/dashboard/widgets/TasksTodayWidget.svelte +++ b/apps/manacore/apps/web/src/lib/components/dashboard/widgets/TasksTodayWidget.svelte @@ -31,8 +31,9 @@ error = result.error; state = 'error'; - // Auto-retry up to 3 times - if (retryCount < 3) { + // Don't retry if service is unavailable (network error) + const isServiceUnavailable = error?.includes('nicht erreichbar'); + if (!isServiceUnavailable && retryCount < 3) { retryCount++; setTimeout(load, 5000 * retryCount); } diff --git a/apps/manacore/apps/web/src/lib/components/dashboard/widgets/TasksUpcomingWidget.svelte b/apps/manacore/apps/web/src/lib/components/dashboard/widgets/TasksUpcomingWidget.svelte index 2e65c4462..a4dd93cd4 100644 --- a/apps/manacore/apps/web/src/lib/components/dashboard/widgets/TasksUpcomingWidget.svelte +++ b/apps/manacore/apps/web/src/lib/components/dashboard/widgets/TasksUpcomingWidget.svelte @@ -31,7 +31,9 @@ error = result.error; state = 'error'; - if (retryCount < 3) { + // Don't retry if service is unavailable (network error) + const isServiceUnavailable = error?.includes('nicht erreichbar'); + if (!isServiceUnavailable && retryCount < 3) { retryCount++; setTimeout(load, 5000 * retryCount); } diff --git a/apps/manacore/apps/web/src/lib/components/dashboard/widgets/ZitareQuoteWidget.svelte b/apps/manacore/apps/web/src/lib/components/dashboard/widgets/ZitareQuoteWidget.svelte index 1ad0c29bc..f223f0ba5 100644 --- a/apps/manacore/apps/web/src/lib/components/dashboard/widgets/ZitareQuoteWidget.svelte +++ b/apps/manacore/apps/web/src/lib/components/dashboard/widgets/ZitareQuoteWidget.svelte @@ -34,7 +34,9 @@ error = result.error; state = 'error'; - if (retryCount < 3) { + // Don't retry if service is unavailable (network error) + const isServiceUnavailable = error?.includes('nicht erreichbar'); + if (!isServiceUnavailable && retryCount < 3) { retryCount++; setTimeout(load, 5000 * retryCount); } @@ -53,7 +55,7 @@

- + =� {$_('dashboard.widgets.zitare.title')}

{#if state === 'success' && data} @@ -108,7 +110,7 @@ rel="noopener" class="block text-center text-sm text-primary hover:underline" > - {$_('dashboard.widgets.zitare.view_all')} ’ + {$_('dashboard.widgets.zitare.view_all')} �
{/if} diff --git a/apps/manacore/apps/web/src/lib/stores/auth.svelte.ts b/apps/manacore/apps/web/src/lib/stores/auth.svelte.ts index 648a865ca..12cb7b306 100644 --- a/apps/manacore/apps/web/src/lib/stores/auth.svelte.ts +++ b/apps/manacore/apps/web/src/lib/stores/auth.svelte.ts @@ -94,6 +94,15 @@ export const authStore = { const userData = await authService.getUserFromToken(); user = userData; + // Mark as initialized so initialize() doesn't override + initialized = true; + loading = false; + + // Update token manager state to reflect valid token + if (_tokenManager) { + await _tokenManager.getValidToken(); + } + return { success: true }; } catch (error) { const errorMessage = error instanceof Error ? error.message : 'Unknown error'; diff --git a/apps/manacore/apps/web/src/routes/(app)/+layout.svelte b/apps/manacore/apps/web/src/routes/(app)/+layout.svelte index 35973e78e..f4413aa2a 100644 --- a/apps/manacore/apps/web/src/routes/(app)/+layout.svelte +++ b/apps/manacore/apps/web/src/routes/(app)/+layout.svelte @@ -137,6 +137,9 @@ }); onMount(async () => { + // Initialize auth store first + await authStore.initialize(); + // Initialize sidebar mode from localStorage const savedSidebar = localStorage.getItem('manacore-nav-sidebar'); if (savedSidebar === 'true') { @@ -151,19 +154,19 @@ collapsedStore.set(true); } - // Load user settings from server + // Load user settings from server (don't await - let it load in background) if (authStore.isAuthenticated) { - await userSettings.load(); - - // Redirect to start page if on /dashboard and a custom start page is set - const currentPath = window.location.pathname; - if ( - currentPath === '/dashboard' && - userSettings.startPage && - userSettings.startPage !== '/dashboard' - ) { - goto(userSettings.startPage, { replaceState: true }); - } + userSettings.load().then(() => { + // Redirect to start page if on /dashboard and a custom start page is set + const currentPath = window.location.pathname; + if ( + currentPath === '/dashboard' && + userSettings.startPage && + userSettings.startPage !== '/dashboard' + ) { + goto(userSettings.startPage, { replaceState: true }); + } + }); } loading = false; diff --git a/apps/manacore/apps/web/src/routes/(auth)/+layout.svelte b/apps/manacore/apps/web/src/routes/(auth)/+layout.svelte index 9cbdab613..b20b848ee 100644 --- a/apps/manacore/apps/web/src/routes/(auth)/+layout.svelte +++ b/apps/manacore/apps/web/src/routes/(auth)/+layout.svelte @@ -1,11 +1,14 @@