From f370c0872f09a83da99f9034abff51ea91ac811a Mon Sep 17 00:00:00 2001 From: Alexandr SaVBaD Waltz Date: Mon, 13 Oct 2025 14:21:19 +0300 Subject: [PATCH] Features: 1) Add error handling for invalid token scenarios with `isTokenInvalidError` in `useRefresh`; 2) Integrate `useLogout` logic in `useRefresh` for improved redirection after token expiration; 3) Optimize server-side refresh operations with conditional execution in `app.vue`; 4) Enhance form behavior in `input.vue` with dynamic `autocapitalize` attribute. Fixes: 1) Improve error notification handling in `useRefresh` with detailed GraphQL message extraction; 2) Address missing token reassignments for `refreshToken` and `accessToken` in `useRefresh`; 3) Resolve redundant refresh execution in non-server environments of `app.vue`. Extra: 1) Refactor `useRefresh` for cleaner error handling and better modularity; 2) Cleanup unused comments and enhance log messages for easier debugging; 3) Organize imports across updated files for standardization. --- storefront/app.vue | 14 ++-- storefront/components/ui/input.vue | 1 + storefront/composables/auth/useRefresh.ts | 88 ++++++++++++++++------- 3 files changed, 73 insertions(+), 30 deletions(-) diff --git a/storefront/app.vue b/storefront/app.vue index 56dd9aef..f7ce1fab 100644 --- a/storefront/app.vue +++ b/storefront/app.vue @@ -59,12 +59,14 @@ const { isSupportedLocale } = useLocaleRedirect(); let refreshInterval: NodeJS.Timeout; -await Promise.all([ - refresh(), - useLanguages(), - useCompanyInfo(), - getCategories() -]); +if (import.meta.server) { + await Promise.all([ + refresh(), + useLanguages(), + useCompanyInfo(), + getCategories() + ]); +} watch( () => appStore.activeState, diff --git a/storefront/components/ui/input.vue b/storefront/components/ui/input.vue index 6eff5f16..16a05620 100644 --- a/storefront/components/ui/input.vue +++ b/storefront/components/ui/input.vue @@ -9,6 +9,7 @@ @keydown="numberOnly ? onlyNumbersKeydown($event) : null" class="block__input" :inputmode="inputMode || 'text'" + :autocapitalize="type === 'input' ? 'off' : 'on'" >