|
1 |
| -import xml2js from "xml2js"; |
2 |
| -import { INPUTS_DATA_XML_FILEPATH } from "../../config"; |
3 | 1 | import { Decorators } from "divaservices-utils";
|
4 |
| -import { dataTestDecorator } from "./dataTestDecorator"; |
5 | 2 | import { getServicesAPI } from "../api/requests";
|
6 | 3 |
|
7 | 4 | export let webservices;
|
8 | 5 | export let dataInputs;
|
9 | 6 |
|
10 |
| -const createXml2jsPromise = xml => { |
11 |
| - return new Promise((resolve, reject) => { |
12 |
| - xml2js.parseString(xml, async (err, data) => { |
13 |
| - if (err) { |
14 |
| - reject(err); |
15 |
| - } else { |
16 |
| - resolve(data); |
17 |
| - } |
18 |
| - }); |
19 |
| - }); |
20 |
| -}; |
21 |
| - |
22 | 7 | const _initWebservices = async () => {
|
23 | 8 | const xml = await getServicesAPI();
|
24 |
| - const data = await createXml2jsPromise(xml); |
25 |
| - webservices = Decorators.webservicesDecorator(data); |
| 9 | + webservices = await Decorators.webservicesDecorator(xml); |
26 | 10 | };
|
27 | 11 |
|
28 |
| -const _initDataInputs = async () => { |
29 |
| - const inputDataFilePath = INPUTS_DATA_XML_FILEPATH; |
30 |
| - const inputDataXml = (await import(`!!raw-loader!../../${inputDataFilePath}`)) |
31 |
| - .default; |
32 |
| - const dataTest = await createXml2jsPromise(inputDataXml); |
33 |
| - dataInputs = dataTestDecorator(dataTest); |
34 |
| -}; |
| 12 | +// const _initDataInputs = async () => { |
| 13 | +// const inputDataFilePath = INPUTS_DATA_XML_FILEPATH; |
| 14 | +// const inputDataXml = (await import(`!!raw-loader!../../${inputDataFilePath}`)) |
| 15 | +// .default; |
| 16 | +// const dataTest = await createXml2jsPromise(inputDataXml); |
| 17 | +// dataInputs = dataTestDecorator(dataTest); |
| 18 | +// }; |
35 | 19 |
|
36 | 20 | // init webservices from xml file
|
37 | 21 | export const initWebservices = async () => {
|
38 | 22 | await _initWebservices();
|
39 |
| - await _initDataInputs(); |
| 23 | + // await _initDataInputs(); |
40 | 24 | };
|
41 | 25 |
|
42 | 26 | export const getWebserviceByName = name => {
|
|
0 commit comments