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:
@@ -4,8 +4,8 @@
|
|||||||
* Provides common data and methods for all merchant pages
|
* Provides common data and methods for all merchant pages
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Use centralized logger
|
// Use centralized logger (guarded: log-config.js loads with defer, so it may not be ready yet)
|
||||||
const merchantLog = window.LogConfig.log;
|
const merchantLog = (window.LogConfig && window.LogConfig.log) || console.log;
|
||||||
|
|
||||||
console.log('[MERCHANT INIT-ALPINE] Loading...');
|
console.log('[MERCHANT INIT-ALPINE] Loading...');
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
* Provides common data and methods for all store pages
|
* Provides common data and methods for all store pages
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// ✅ Use centralized logger
|
// Use centralized logger (guarded: log-config.js loads with defer, so it may not be ready yet)
|
||||||
const storeLog = window.LogConfig.log;
|
const storeLog = (window.LogConfig && window.LogConfig.log) || console.log;
|
||||||
|
|
||||||
console.log('[STORE INIT-ALPINE] Loading...');
|
console.log('[STORE INIT-ALPINE] Loading...');
|
||||||
|
|
||||||
@@ -267,4 +267,4 @@ function emailSettingsWarning() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
window.emailSettingsWarning = emailSettingsWarning;
|
window.emailSettingsWarning = emailSettingsWarning;
|
||||||
|
|||||||
Reference in New Issue
Block a user