Refactor onUpdate naming

This commit is contained in:
KoalaSat
2024-03-04 20:30:25 +01:00
parent 383a2650ba
commit e3923fc4ea
2 changed files with 5 additions and 5 deletions

View File

@ -106,7 +106,7 @@ export const FederationContextProvider = ({
useEffect(() => {
// On bitcoin network change we reset book, limits and federation info and fetch everything again
const newFed = initialFederationContext.federation;
newFed.registerHook('onFederationReady', () => {
newFed.registerHook('onFederationUpdate', () => {
setFederationUpdatedAt(new Date().toISOString());
});
newFed.registerHook('onCoordinatorUpdate', () => {

View File

@ -11,7 +11,7 @@ import defaultFederation from '../../static/federation.json';
import { getHost } from '../utils';
import { updateExchangeInfo } from './Exchange.model';
type FederationHooks = 'onCoordinatorUpdate' | 'onFederationReady';
type FederationHooks = 'onCoordinatorUpdate' | 'onFederationUpdate';
export class Federation {
constructor() {
@ -34,7 +34,7 @@ export class Federation {
this.book = [];
this.hooks = {
onCoordinatorUpdate: [],
onFederationReady: [],
onFederationUpdate: [],
};
this.loading = true;
}
@ -67,7 +67,7 @@ export class Federation {
this.loading = this.exchange.loadingCoordinators > 0;
if (Object.values(this.coordinators).every((coor) => coor.isUpdated())) {
this.updateExchange();
this.triggerHook('onFederationReady');
this.triggerHook('onFederationUpdate');
}
};
@ -119,7 +119,7 @@ export class Federation {
updateExchange = (): void => {
this.exchange.info = updateExchangeInfo(this);
this.triggerHook('onCoordinatorUpdate');
this.triggerHook('onFederationUpdate');
};
// Fetchs