chore(api-client): drop dead /shop/ path branches (migrated to /storefront long ago)
Some checks failed
CI / ruff (push) Successful in 16s
CI / validate (push) Has been cancelled
CI / dependency-scanning (push) Has been cancelled
CI / docs (push) Has been cancelled
CI / deploy (push) Has been cancelled
CI / pytest (push) Has been cancelled

The customer-area used to be mounted at /shop/* and was migrated to
/storefront long ago, but apiClient.js still carried the dead /shop/
checks alongside the live ones added in a0ae6388. Removed:

- /shop/ + /api/v1/shop/ predicates from getToken()'s customer-area
  branch (lines 62-63).
- Same predicates from clearTokens()'s customer-area branch
  (lines 409-410).
- Updated both functions' JSDoc to list the actual live paths
  (/account/* + /api/v1/storefront/*) and to mention the /merchants/*
  branch that was already in code but missing from the comment.

No behaviour change — verified zero callers via grep across app/,
static/, middleware/. The /shop/ branches always evaluated false in
production.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-29 21:37:37 +02:00
parent a0ae638821
commit 856db328b5

View File

@@ -37,7 +37,8 @@ class APIClient {
* Uses path-based detection to return the correct token:
* - /admin/* routes use admin_token
* - /store/* routes use store_token
* - /shop/* routes use customer_token
* - /account/* or /api/v1/storefront/* routes use customer_token
* - /merchants/* routes use merchant_token
* - Other routes fall back to admin_token || store_token || customer_token
*/
getToken() {
@@ -58,9 +59,7 @@ class APIClient {
source = 'admin (path-based)';
} else if (
currentPath.startsWith('/account/') ||
currentPath.startsWith('/api/v1/storefront/') ||
currentPath.includes('/shop/') ||
currentPath.startsWith('/api/v1/shop/')
currentPath.startsWith('/api/v1/storefront/')
) {
token = customerToken;
source = 'customer (path-based)';
@@ -374,7 +373,8 @@ class APIClient {
* Uses path-based detection to clear only the relevant token:
* - /admin/* paths clear admin_token
* - /store/* paths clear store_token
* - /shop/* paths clear customer_token
* - /account/* or /api/v1/storefront/* paths clear customer_token
* - /merchants/* paths clear merchant_token
* - Other paths clear all tokens (fallback)
*/
clearTokens() {
@@ -405,9 +405,7 @@ class APIClient {
localStorage.removeItem('storeCode');
} else if (
currentPath.startsWith('/account/') ||
currentPath.startsWith('/api/v1/storefront/') ||
currentPath.includes('/shop/') ||
currentPath.startsWith('/api/v1/shop/')
currentPath.startsWith('/api/v1/storefront/')
) {
apiLog.info('Clearing customer tokens only');
localStorage.removeItem('customer_token');