@revenexx/cover 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revenexx/cover",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Cover — revenexx design system for Nuxt. Distributed as a Nuxt layer: generic UI components, theming tokens and stores shared by the demo shop, custom storefronts and the Blokkli theme.",
5
5
  "type": "module",
6
6
  "main": "./nuxt.config.ts",
@@ -111,10 +111,20 @@ export class ApiAuthService implements IAuthService {
111
111
  };
112
112
  }
113
113
  catch (err) {
114
- if (!isApiUserError(err)) {
115
- getLogService().error("API request failed: auth/me", apiErrorContext(err));
114
+ // Only a genuine auth failure (401 = revoked/expired session) proves
115
+ // the session is gone — clear the cookie so the user logs out cleanly.
116
+ // Any other error (5xx like the gateway's "capability dispatch failed",
117
+ // or a network blip) is transient infrastructure trouble, NOT proof the
118
+ // session is invalid. Deleting the cookie here turned a flaky gateway
119
+ // into a SILENT LOGOUT + empty order history (the account history is
120
+ // filtered strictly by contact_id and falls back to me()). So keep the
121
+ // cookie and return null: callers still degrade to the guest path for
122
+ // this one request, and the session self-heals on the next.
123
+ if (isApiUserError(err) && err.code === 401) {
124
+ deleteCookie(event, SESSION_COOKIE_NAME, sessionCookieOptions());
125
+ return null;
116
126
  }
117
- deleteCookie(event, SESSION_COOKIE_NAME, sessionCookieOptions());
127
+ getLogService().error("API request failed: auth/me", apiErrorContext(err));
118
128
  return null;
119
129
  }
120
130
  }