mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 09:31:09 -05:00
Fix modal not opening when users try to sign in or join
Update Alpine.js components to correctly handle global events for showing the authentication modal, resolving the issue where tapping sign in or join buttons did not open the modal. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 495199c6-aa06-48cd-8c40-9cccf398cfcf Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d6d61dac-164d-45dd-929f-7dcdfd771b64/495199c6-aa06-48cd-8c40-9cccf398cfcf/4DtGbtV
This commit is contained in:
@@ -375,6 +375,13 @@ Alpine.data('authModal', (defaultMode = 'login') => ({
|
||||
this.resetForms();
|
||||
}
|
||||
});
|
||||
|
||||
// Listen for global auth modal events
|
||||
document.addEventListener('show-auth-modal', (event) => {
|
||||
const mode = event.detail?.mode || 'login';
|
||||
this.show(mode);
|
||||
console.log('Auth modal opened via event:', mode);
|
||||
});
|
||||
},
|
||||
|
||||
async fetchSocialProviders() {
|
||||
@@ -618,6 +625,21 @@ Alpine.store('toast', {
|
||||
});
|
||||
|
||||
console.log('All Alpine.js components registered successfully');
|
||||
|
||||
// Expose global authModal instance for mobile buttons
|
||||
if (typeof window !== 'undefined') {
|
||||
window.authModal = {
|
||||
show: (mode = 'login') => {
|
||||
// Dispatch custom event to trigger auth modal
|
||||
const event = new CustomEvent('show-auth-modal', {
|
||||
detail: { mode: mode }
|
||||
});
|
||||
document.dispatchEvent(event);
|
||||
console.log('Auth modal event dispatched:', mode);
|
||||
}
|
||||
};
|
||||
console.log('Global authModal exposed on window');
|
||||
}
|
||||
}
|
||||
|
||||
// Try multiple registration approaches
|
||||
|
||||
Reference in New Issue
Block a user