fix: Initialize home page after component creation

**Motivations :**
- Fix blank page after account deletion
- Ensure home page is properly initialized when navigating to home
- Add proper initialization call after login-4nk-component creation

**Modifications :**
- Added initHomePage() call after login-4nk-component is added to DOM
- Added error handling for home page initialization
- Added debug logs to track initialization process

**Pages affectées :**
- src/router.ts - Added home page initialization in handleLocation
This commit is contained in:
NicolasCantu 2025-10-23 21:04:35 +02:00
parent 1d711932ce
commit 73b8d722c2
2 changed files with 18 additions and 8 deletions

View File

@ -55,6 +55,16 @@ async function handleLocation(path: string) {
'width: 100vw; height: 100vh; position: relative; grid-row: 2;' 'width: 100vw; height: 100vh; position: relative; grid-row: 2;'
); );
if (container) container.appendChild(accountComponent); if (container) container.appendChild(accountComponent);
// Initialize the home page after component is added to DOM
console.log('🏠 Initializing home page...');
try {
const { initHomePage } = await import('./pages/home/home');
await initHomePage();
console.log('✅ Home page initialized successfully');
} catch (error) {
console.error('❌ Failed to initialize home page:', error);
}
} else { } else {
const html = await fetch(routeHtml).then(data => data.text()); const html = await fetch(routeHtml).then(data => data.text());
content.innerHTML = html; content.innerHTML = html;