From 856db328b5ddcef8a439f948a8ccb4dba0e84d1d Mon Sep 17 00:00:00 2001 From: Samir Boulahtit Date: Fri, 29 May 2026 21:37:37 +0200 Subject: [PATCH] chore(api-client): drop dead /shop/ path branches (migrated to /storefront long ago) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- static/shared/js/api-client.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/static/shared/js/api-client.js b/static/shared/js/api-client.js index 31ed6703..5ff71ac6 100644 --- a/static/shared/js/api-client.js +++ b/static/shared/js/api-client.js @@ -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');