mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	refactor: remove client from frontend api (#6490)
There was extra call getClient().getAll() not needed and complicating readability.
This commit is contained in:
		
							parent
							
								
									17ea8b3734
								
							
						
					
					
						commit
						2997faecf6
					
				@ -39,7 +39,6 @@ import { Notifications } from 'component/common/Notifications/Notifications';
 | 
			
		||||
import { useAdminRoutes } from 'component/admin/useAdminRoutes';
 | 
			
		||||
import InviteLinkButton from './InviteLink/InviteLinkButton/InviteLinkButton';
 | 
			
		||||
import { useUiFlag } from 'hooks/useUiFlag';
 | 
			
		||||
import { INavigationMenuItem } from '../../../interfaces/route';
 | 
			
		||||
import { Badge } from '../../common/Badge/Badge';
 | 
			
		||||
 | 
			
		||||
const StyledHeader = styled(AppBar)(({ theme }) => ({
 | 
			
		||||
 | 
			
		||||
@ -1,5 +1,5 @@
 | 
			
		||||
import { IFeatureToggleClient } from '../types';
 | 
			
		||||
 | 
			
		||||
export interface IClientFeatureToggleReadModel {
 | 
			
		||||
    getClient(): Promise<Record<string, Record<string, IFeatureToggleClient>>>;
 | 
			
		||||
    getAll(): Promise<Record<string, Record<string, IFeatureToggleClient>>>;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -25,7 +25,7 @@ export default class ClientFeatureToggleReadModel
 | 
			
		||||
            });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private async getAll(): Promise<
 | 
			
		||||
    public async getAll(): Promise<
 | 
			
		||||
        Record<string, Record<string, IFeatureToggleClient>>
 | 
			
		||||
    > {
 | 
			
		||||
        const stopTimer = this.timer(`getAll`);
 | 
			
		||||
@ -180,10 +180,4 @@ export default class ClientFeatureToggleReadModel
 | 
			
		||||
            !feature.strategies?.find((s) => s?.id === row.strategy_id)
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    async getClient(): Promise<
 | 
			
		||||
        Record<string, Record<string, IFeatureToggleClient>>
 | 
			
		||||
    > {
 | 
			
		||||
        return this.getAll();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -11,7 +11,7 @@ export default class FakeClientFeatureToggleReadModel
 | 
			
		||||
        > = {},
 | 
			
		||||
    ) {}
 | 
			
		||||
 | 
			
		||||
    getClient(): Promise<Record<string, Record<string, IFeatureToggleClient>>> {
 | 
			
		||||
    getAll(): Promise<Record<string, Record<string, IFeatureToggleClient>>> {
 | 
			
		||||
        return Promise.resolve(this.value);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -118,7 +118,7 @@ export class GlobalFrontendApiCache extends EventEmitter {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private async getAllFeatures(): Promise<FrontendApiFeatureCache> {
 | 
			
		||||
        const features = await this.clientFeatureToggleReadModel.getClient();
 | 
			
		||||
        const features = await this.clientFeatureToggleReadModel.getAll();
 | 
			
		||||
        return this.mapFeatures(features);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user