From f173a274e819107e2049bd9bc48bd1451d72876e Mon Sep 17 00:00:00 2001 From: Bastian Masanek Date: Fri, 21 Nov 2025 11:57:18 +0100 Subject: [PATCH] Integrate fetchCart function to refresh the cart upon user login - Ensuring existing items are displayed immediately. - This enhancement improves user experience by providing instant visibility of cart contents after authentication. --- app/composables/useAuth.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/composables/useAuth.ts b/app/composables/useAuth.ts index d77164a..42a0416 100644 --- a/app/composables/useAuth.ts +++ b/app/composables/useAuth.ts @@ -12,6 +12,7 @@ export function useAuth() { const { loggedIn, user, clear, fetch } = useUserSession() const { fetchRoleStatus } = useActiveRole() + const { fetchCart } = useCart() /** * Login with email and password @@ -41,6 +42,9 @@ export function useAuth() { // Fetch user roles immediately after login await fetchRoleStatus() + // Refresh cart after login to show any existing items + await fetchCart() + // Redirect to products page or saved destination const redirectAfterLogin = useCookie('redirect_after_login') const destination = redirectAfterLogin.value || '/'