Conditions | 1 |
Total Lines | 19 |
Code Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | /** |
||
6 | |||
7 | // eslint-disable-next-line sw-deprecation-rules/private-feature-declarations |
||
8 | export default function initializeApiServices() { |
||
9 | // Add custom api service providers |
||
10 | apiServices.forEach((ApiService) => { |
||
11 | const factoryContainer = Shopware.Application.getContainer('factory'); |
||
12 | const initContainer = Shopware.Application.getContainer('init'); |
||
13 | |||
14 | const apiServiceFactory = factoryContainer.apiService; |
||
15 | // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-assignment |
||
16 | const service = new ApiService(initContainer.httpClient, Shopware.Service('loginService')); |
||
17 | // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access |
||
18 | const serviceName = service.name as keyof ServiceContainer; |
||
19 | // eslint-disable-next-line @typescript-eslint/no-unsafe-argument |
||
20 | apiServiceFactory.register(serviceName, service); |
||
21 | |||
22 | Shopware.Application.addServiceProvider(serviceName, () => { |
||
23 | // eslint-disable-next-line @typescript-eslint/no-unsafe-return |
||
24 | return service; |
||
25 | }); |
||
28 |