| Total Complexity | 3 |
| Total Lines | 27 |
| Duplicated Lines | 100 % |
| Changes | 0 | ||
Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
| 1 | View Code Duplication | import ApiService from '../api.service'; |
|
| 7 | class BusinessEventsApiService extends ApiService { |
||
| 8 | constructor(httpClient, loginService, apiEndpoint = 'business-events') { |
||
| 9 | super(httpClient, loginService, apiEndpoint); |
||
| 10 | this.name = 'businessEventService'; |
||
| 11 | } |
||
| 12 | |||
| 13 | /** |
||
| 14 | * Get all business events |
||
| 15 | * |
||
| 16 | * @param {Object} [additionalParams = {}] |
||
| 17 | * @param {Object} [additionalHeaders = {}] |
||
| 18 | * @returns {Promise<T>} |
||
| 19 | */ |
||
| 20 | getBusinessEvents(additionalParams = {}, additionalHeaders = {}) { |
||
| 21 | const params = additionalParams; |
||
| 22 | const headers = this.getBasicHeaders(additionalHeaders); |
||
| 23 | |||
| 24 | return this.httpClient |
||
| 25 | .get('/_info/events.json', { |
||
| 26 | params, |
||
| 27 | headers |
||
| 28 | }) |
||
| 29 | .then((response) => { |
||
| 30 | return ApiService.handleResponse(response); |
||
| 31 | }); |
||
| 32 | } |
||
| 33 | } |
||
| 34 | |||
| 36 |