mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-10-31 02:57:57 +00:00 
			
		
		
		
	Merge branch 'hotfix/1.4.2' into develop
This commit is contained in:
		| @@ -1,10 +1,10 @@ | ||||
| /* global axios */ | ||||
|  | ||||
| const API_VERSION = `/api/v1`; | ||||
| const DEFAULT_API_VERSION = 'v1'; | ||||
|  | ||||
| class ApiClient { | ||||
|   constructor(resource, options = {}) { | ||||
|     this.apiVersion = API_VERSION; | ||||
|     this.apiVersion = `/api/${options.apiVersion || DEFAULT_API_VERSION}`; | ||||
|     this.options = options; | ||||
|     this.resource = resource; | ||||
|   } | ||||
|   | ||||
| @@ -3,7 +3,7 @@ import ApiClient from './ApiClient'; | ||||
|  | ||||
| class ReportsAPI extends ApiClient { | ||||
|   constructor() { | ||||
|     super('reports', { accountScoped: true }); | ||||
|     super('reports', { accountScoped: true, apiVersion: 'v2' }); | ||||
|   } | ||||
|  | ||||
|   getAccountReports(metric, since, until) { | ||||
|   | ||||
							
								
								
									
										16
									
								
								app/javascript/dashboard/api/specs/reports.spec.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								app/javascript/dashboard/api/specs/reports.spec.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | ||||
| import reports from '../reports'; | ||||
| import ApiClient from '../ApiClient'; | ||||
|  | ||||
| describe('#Reports API', () => { | ||||
|   it('creates correct instance', () => { | ||||
|     expect(reports).toBeInstanceOf(ApiClient); | ||||
|     expect(reports.apiVersion).toBe('/api/v2'); | ||||
|     expect(reports).toHaveProperty('get'); | ||||
|     expect(reports).toHaveProperty('show'); | ||||
|     expect(reports).toHaveProperty('create'); | ||||
|     expect(reports).toHaveProperty('update'); | ||||
|     expect(reports).toHaveProperty('delete'); | ||||
|     expect(reports).toHaveProperty('getAccountReports'); | ||||
|     expect(reports).toHaveProperty('getAccountSummary'); | ||||
|   }); | ||||
| }); | ||||
		Reference in New Issue
	
	Block a user
	 Pranav Raj Sreepuram
					Pranav Raj Sreepuram