Spaces:
Sleeping
Sleeping
Add debug logs
Browse files- static/js/app.js +22 -17
static/js/app.js
CHANGED
|
@@ -3,6 +3,8 @@
|
|
| 3 |
* SPA Router and State Management
|
| 4 |
*/
|
| 5 |
|
|
|
|
|
|
|
| 6 |
const app = {
|
| 7 |
currentRoute: 'home',
|
| 8 |
currentComponent: null,
|
|
@@ -20,14 +22,17 @@ const app = {
|
|
| 20 |
* Initialize the application
|
| 21 |
*/
|
| 22 |
async init() {
|
|
|
|
|
|
|
|
|
|
| 23 |
console.log('Initializing Mi Pesca RD...');
|
| 24 |
|
| 25 |
-
|
| 26 |
-
|
| 27 |
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
|
| 32 |
/**
|
| 33 |
* Navigate to a route
|
|
@@ -56,21 +61,21 @@ const app = {
|
|
| 56 |
this.render();
|
| 57 |
},
|
| 58 |
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
}
|
| 73 |
}
|
|
|
|
| 74 |
};
|
| 75 |
|
| 76 |
// Initialize app when DOM is ready
|
|
|
|
| 3 |
* SPA Router and State Management
|
| 4 |
*/
|
| 5 |
|
| 6 |
+
console.log('app.js loaded');
|
| 7 |
+
|
| 8 |
const app = {
|
| 9 |
currentRoute: 'home',
|
| 10 |
currentComponent: null,
|
|
|
|
| 22 |
* Initialize the application
|
| 23 |
*/
|
| 24 |
async init() {
|
| 25 |
+
console.log('HomeComponent.init() starting...');
|
| 26 |
+
await this.updateSyncStatus();
|
| 27 |
+
console.log('HomeComponent.init() success'); starting...');
|
| 28 |
console.log('Initializing Mi Pesca RD...');
|
| 29 |
|
| 30 |
+
// Initialize sync service
|
| 31 |
+
syncService.init();
|
| 32 |
|
| 33 |
+
// Load initial route
|
| 34 |
+
this.navigate('home');
|
| 35 |
+
},
|
| 36 |
|
| 37 |
/**
|
| 38 |
* Navigate to a route
|
|
|
|
| 61 |
this.render();
|
| 62 |
},
|
| 63 |
|
| 64 |
+
/**
|
| 65 |
+
* Render current component
|
| 66 |
+
*/
|
| 67 |
+
render() {
|
| 68 |
+
const appContainer = document.getElementById('app');
|
| 69 |
|
| 70 |
+
if (!appContainer) {
|
| 71 |
+
console.error('App container not found');
|
| 72 |
+
return;
|
| 73 |
+
}
|
| 74 |
|
| 75 |
+
if (this.currentComponent && this.currentComponent.render) {
|
| 76 |
+
appContainer.innerHTML = this.currentComponent.render();
|
|
|
|
| 77 |
}
|
| 78 |
+
}
|
| 79 |
};
|
| 80 |
|
| 81 |
// Initialize app when DOM is ready
|