fix: guard LogConfig access in merchant and store init-alpine.js

log-config.js loads with defer but init-alpine.js runs synchronously,
so window.LogConfig is undefined when init-alpine.js executes. The
crash prevented the Alpine data() function from registering, which
broke auth and caused all merchant pages to 302-redirect to login.

Fall back to console.log when LogConfig is not yet available.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-22 22:13:30 +01:00
parent 1f3042547b
commit 5c8fbd21c7
2 changed files with 5 additions and 5 deletions

View File

@@ -4,8 +4,8 @@
* Provides common data and methods for all merchant pages
*/
// Use centralized logger
const merchantLog = window.LogConfig.log;
// Use centralized logger (guarded: log-config.js loads with defer, so it may not be ready yet)
const merchantLog = (window.LogConfig && window.LogConfig.log) || console.log;
console.log('[MERCHANT INIT-ALPINE] Loading...');

View File

@@ -4,8 +4,8 @@
* Provides common data and methods for all store pages
*/
// Use centralized logger
const storeLog = window.LogConfig.log;
// Use centralized logger (guarded: log-config.js loads with defer, so it may not be ready yet)
const storeLog = (window.LogConfig && window.LogConfig.log) || console.log;
console.log('[STORE INIT-ALPINE] Loading...');
@@ -267,4 +267,4 @@ function emailSettingsWarning() {
};
}
window.emailSettingsWarning = emailSettingsWarning;
window.emailSettingsWarning = emailSettingsWarning;