Fix updateUserStatus call in static method getInstance
**Motivations :** - this.updateUserStatus is not a function dans la méthode statique getInstance() - Dans une méthode statique, this n'existe pas - Besoin d'une fonction helper pour mettre à jour le statut depuis un contexte statique **Modifications :** - service.ts : Création de la fonction helper updateUserStatusHelper() pour être utilisée dans les méthodes statiques - service.ts : Remplacement de this.updateUserStatus() par updateUserStatusHelper() dans getInstance() - service.ts : La méthode privée updateUserStatus() reste disponible pour les méthodes d'instance **Pages affectées :** - src/services/service.ts : Correction des appels à updateUserStatus dans le contexte statique
This commit is contained in:
parent
72e7f9b920
commit
e811b8275b
@ -30,6 +30,22 @@ const BLINDBITURL = import.meta.env.VITE_BLINDBITURL || `${BASEURL}:8000`;
|
||||
const DEFAULTAMOUNT = 1000n;
|
||||
|
||||
// Global loading spinner functions removed - now using updateUserStatus instead
|
||||
|
||||
// Helper function to update user status (can be called from static methods)
|
||||
function updateUserStatusHelper(message: string): void {
|
||||
try {
|
||||
const container = document.querySelector('login-4nk-component') as HTMLElement;
|
||||
const mainStatus = container?.querySelector('#main-status') as HTMLElement;
|
||||
if (mainStatus) {
|
||||
// Add timestamp for better user experience
|
||||
const timestamp = new Date().toLocaleTimeString();
|
||||
mainStatus.innerHTML = `<span style="color: var(--info-color)">[${timestamp}] ${message}</span>`;
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn('Could not update user status:', error);
|
||||
}
|
||||
}
|
||||
|
||||
const EMPTY32BYTES = String('').padStart(64, '0');
|
||||
|
||||
export default class Services {
|
||||
@ -113,8 +129,8 @@ export default class Services {
|
||||
}
|
||||
}
|
||||
|
||||
// Update user status during initialization
|
||||
this.updateUserStatus('🔄 Initializing services...');
|
||||
// Update user status during initialization (using helper function)
|
||||
updateUserStatusHelper('🔄 Initializing services...');
|
||||
|
||||
// Add WebAssembly memory optimization and error handling
|
||||
try {
|
||||
@ -249,7 +265,7 @@ export default class Services {
|
||||
}
|
||||
|
||||
// Update user status after successful initialization
|
||||
this.updateUserStatus('✅ Services initialized successfully');
|
||||
updateUserStatusHelper('✅ Services initialized successfully');
|
||||
|
||||
return Services.instance;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user