fix: loyalty module end-to-end — merchant route, store menus, sidebar, API error handling
Some checks failed
Some checks failed
- Add merchant loyalty overview route and template (was 404)
- Fix store loyalty route paths to match menu URLs (/{store_code}/loyalty/...)
- Add loyalty rewards card to storefront account dashboard
- Fix merchant overview to resolve merchant via get_merchant_for_current_user_page
- Fix store login to use store's primary platform for JWT token (interim fix)
- Fix apiClient to attach status/errorCode to thrown errors (fixes error.status
checks in 12+ JS files — loyalty settings, terminal, email templates, etc.)
- Hide "Add Product" sidebar button when catalog module is not enabled
- Add proposal doc for proper platform detection in store login flow
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -150,7 +150,10 @@ class APIClient {
|
||||
|
||||
const errorMessage = data.message || data.detail || 'Unauthorized - please login again';
|
||||
apiLog.error('Throwing authentication error:', errorMessage);
|
||||
throw new Error(errorMessage);
|
||||
const authError = new Error(errorMessage);
|
||||
authError.status = response.status;
|
||||
authError.errorCode = data.error_code;
|
||||
throw authError;
|
||||
}
|
||||
|
||||
// Handle non-OK responses
|
||||
@@ -161,7 +164,10 @@ class APIClient {
|
||||
message: errorMessage,
|
||||
errorCode: data.error_code
|
||||
});
|
||||
throw new Error(errorMessage);
|
||||
const apiError = new Error(errorMessage);
|
||||
apiError.status = response.status;
|
||||
apiError.errorCode = data.error_code;
|
||||
throw apiError;
|
||||
}
|
||||
|
||||
apiLog.info('Request completed successfully');
|
||||
|
||||
Reference in New Issue
Block a user