mirror of
				https://github.com/richard-loafle/fuse-angular.git
				synced 2025-11-04 01:03:33 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			37 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
import { Injectable } from '@angular/core';
 | 
						|
import { FuseMockApiService } from '@fuse/lib/mock-api';
 | 
						|
import { analytics as analyticsData } from 'app/mock-api/dashboards/analytics/data';
 | 
						|
import { cloneDeep } from 'lodash-es';
 | 
						|
 | 
						|
@Injectable({providedIn: 'root'})
 | 
						|
export class AnalyticsMockApi
 | 
						|
{
 | 
						|
    private _analytics: any = analyticsData;
 | 
						|
 | 
						|
    /**
 | 
						|
     * Constructor
 | 
						|
     */
 | 
						|
    constructor(private _fuseMockApiService: FuseMockApiService)
 | 
						|
    {
 | 
						|
        // Register Mock API handlers
 | 
						|
        this.registerHandlers();
 | 
						|
    }
 | 
						|
 | 
						|
    // -----------------------------------------------------------------------------------------------------
 | 
						|
    // @ Public methods
 | 
						|
    // -----------------------------------------------------------------------------------------------------
 | 
						|
 | 
						|
    /**
 | 
						|
     * Register Mock API handlers
 | 
						|
     */
 | 
						|
    registerHandlers(): void
 | 
						|
    {
 | 
						|
        // -----------------------------------------------------------------------------------------------------
 | 
						|
        // @ Sales - GET
 | 
						|
        // -----------------------------------------------------------------------------------------------------
 | 
						|
        this._fuseMockApiService
 | 
						|
            .onGet('api/dashboards/analytics')
 | 
						|
            .reply(() => [200, cloneDeep(this._analytics)]);
 | 
						|
    }
 | 
						|
}
 |