auth system consolidation

This commit is contained in:
overcuriousity
2025-07-24 20:40:17 +02:00
parent 209f173d7a
commit 1f33ad1b16
4 changed files with 15 additions and 69 deletions

View File

@@ -53,7 +53,7 @@ const tools = data.tools;
</button>
<!-- Contribution Button - FIXED: Use data-contribute-button -->
<a href="/contribute" class="btn" style="padding: 0.75rem 1.5rem; background-color: var(--color-warning); color: white; border-color: var(--color-warning);" data-contribute-button>
<a href="/contribute" class="btn" style="padding: 0.75rem 1.5rem; background-color: var(--color-warning); color: white; border-color: var(--color-warning);" data-contribute-button="new">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="margin-right: 0.5rem;">
<path d="M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/>
<circle cx="8.5" cy="7" r="4"/>
@@ -143,16 +143,15 @@ const tools = data.tools;
return sorted;
}
}
// FIXED: AI Query Button Handler using global client-side auth function
// OPTIMIZED: AI Query Button Handler using consolidated auth system
if (aiQueryBtn) {
aiQueryBtn.addEventListener('click', async () => {
// Wait for client-side auth functions to be available
// Use the global auth system consistently
if (typeof window.requireClientAuth === 'function') {
await window.requireClientAuth(() => switchToView('ai'), `${window.location.pathname}?view=ai`);
} else {
console.error('requireClientAuth not available - client-auth.js may not be loaded');
// Fallback - try switching anyway
// Better fallback logging
console.warn('[AUTH] requireClientAuth not available - client-auth.js may not be loaded properly');
switchToView('ai');
}
});