Code Duplication    Length = 21-22 lines in 2 locations

src/Administration/Resources/app/administration/src/module/sw-promotion-v2/service/promotion-code.api.service.js 1 location

@@ 8-29 (lines=22) @@
5
 * @class
6
 * @extends ApiService
7
 */
8
export default class PromotionCodeApiService extends ApiService {
9
    constructor(httpClient, loginService, apiEndpoint = 'promotion') {
10
        super(httpClient, loginService, apiEndpoint);
11
        this.name = 'promotionCodeApiService';
12
    }
13
14
    /**
15
     * @returns {Promise<T>}
16
     */
17
    generateCodeFixed() {
18
        const headers = this.getBasicHeaders();
19
20
        return this.httpClient.get(
21
            `/_action/${this.getApiBasePath()}/codes/generate-fixed`,
22
            {
23
                headers
24
            }
25
        ).then((response) => {
26
            return ApiService.handleResponse(response);
27
        });
28
    }
29
}
30

src/Administration/Resources/app/administration/src/core/service/api/message-queue.api.service.js 1 location

@@ 8-28 (lines=21) @@
5
 * @class
6
 * @extends ApiService
7
 */
8
class MessageQueueApiService extends ApiService {
9
    constructor(httpClient, loginService, apiEndpoint = 'message-queue') {
10
        super(httpClient, loginService, apiEndpoint);
11
        this.name = 'messageQueueService';
12
    }
13
14
    /**
15
     * Run all due scheduled tasks
16
     *
17
     * @returns {Promise<T>}
18
     */
19
    consume(receiver) {
20
        const headers = this.getBasicHeaders();
21
22
        return this.httpClient
23
            .post(`/_action/${this.getApiBasePath()}/consume`, { receiver }, { headers })
24
            .then((response) => {
25
                return ApiService.handleResponse(response);
26
            });
27
    }
28
}
29
30
export default MessageQueueApiService;
31